+
+(defun %naturalize-utf8-string (sap)
+ (declare (type system-area-pointer sap))
+ (locally
+ (declare (optimize (speed 3) (safety 0)))
+ (let ((byte-length (do* ((offset 0 (1+ offset))
+ (byte #1=(sap-ref-8 sap offset) #1#))
+ ((zerop byte) offset))))
+ (handler-bind ((sb!impl::octet-decoding-error #'sb!impl::use-unicode-replacement-char))
+ (sb!impl::utf8->string-sap-ref-8 sap 0 byte-length)))))
+
+(defun %deport-utf8-string (string)
+ (declare (type simple-string string))
+ (sb!impl::string->utf8 string 0 (length string) 1))