Changeset 14698
- Timestamp:
- Mar 25, 2011, 2:38:32 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/objc-bridge/objc-support.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/objc-bridge/objc-support.lisp
r14462 r14698 318 318 319 319 (defun lisp-string-from-nsstring (nsstring) 320 ;; The value returned by #/UTF8String is autoreleased. 321 (%get-utf-8-cstring (#/UTF8String nsstring))) 320 (with-autorelease-pool 321 ;; It's not clear that it's even possible to lose information 322 ;; when converting to UTF-8, but allow lossage to occur, just in 323 ;; case. 324 (let* ((data (#/dataUsingEncoding:allowLossyConversion: 325 nsstring #$NSUTF8StringEncoding t)) 326 (len (#/length data))) 327 (if (= len 0) 328 "" 329 (let* ((bytes (#/bytes data)) 330 (nchars (utf-8-length-of-memory-encoding bytes len 0)) 331 (string (make-string nchars))) 332 (utf-8-memory-decode bytes len 0 string) 333 string))))) 334 322 335 323 336
Note:
See TracChangeset
for help on using the changeset viewer.
