Index: src/code/early-alieneval.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/early-alieneval.lisp,v
retrieving revision 1.3
diff -u -r1.3 early-alieneval.lisp
--- src/code/early-alieneval.lisp	15 Oct 2005 13:32:32 -0000	1.3
+++ src/code/early-alieneval.lisp	22 May 2006 21:25:05 -0000
@@ -26,3 +26,6 @@
 ;;;     Lisp idiom for C's return type "void" (which is likely
 ;;;     why it's set when when translating return values)
 (defvar *values-type-okay* nil)
+
+#!+sb-unicode
+(defvar *alien-external-format* nil)
Index: src/code/host-c-call.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/host-c-call.lisp,v
retrieving revision 1.8
diff -u -r1.8 host-c-call.lisp
--- src/code/host-c-call.lisp	13 Jan 2006 11:32:46 -0000	1.8
+++ src/code/host-c-call.lisp	22 May 2006 21:25:25 -0000
@@ -11,28 +11,36 @@
 
 (/show0 "host-c-call.lisp 12")
 
-(define-alien-type-class (c-string :include pointer :include-args (to)))
+(define-alien-type-class (c-string :include pointer :include-args (to))
+  #!+sb-unicode
+  (external-format (alien-external-format) :type keyword))
 
-(define-alien-type-translator c-string ()
+(define-alien-type-translator c-string #!-sb-unicode ()
+                                       #!+sb-unicode (&key (external-format (alien-external-format)))
   (make-alien-c-string-type
-   :to (parse-alien-type 'char (sb!kernel:make-null-lexenv))))
+   :to (parse-alien-type 'char (sb!kernel:make-null-lexenv))
+   #!+sb-unicode :external-format #!+sb-unicode external-format))
+
 
 (define-alien-type-method (c-string :unparse) (type)
-  (declare (ignore type))
-  'c-string)
+  #!-sb-unicode (declare (ignore type))
+  #!-sb-unicode 'c-string
+  #!+sb-unicode
+  (list 'c-string :external-format (alien-c-string-type-external-format type)))
 
 (define-alien-type-method (c-string :lisp-rep) (type)
   (declare (ignore type))
   '(or simple-string null (alien (* char))))
 
 (define-alien-type-method (c-string :naturalize-gen) (type alien)
-  (declare (ignore type))
+  #!-sb-unicode (declare (ignore type))
   `(if (zerop (sap-int ,alien))
        nil
-       (%naturalize-c-string ,alien)))
+       (%naturalize-c-string ,alien
+         #!+sb-unicode (alien-c-string-type-external-format ,type))))
 
 (define-alien-type-method (c-string :deport-gen) (type value)
-  (declare (ignore type))
+  #!-sb-unicode (declare (ignore type))
   `(etypecase ,value
      (null (int-sap 0))
      ((alien (* char)) (alien-sap ,value))
@@ -62,9 +70,12 @@
      ;; we're taking the SAP of a immediately discarded temporary -> the
      ;; conservativeness doesn't protect us.
      ;; -- JES, 2006-01-13
-     (simple-string (vector-sap (coerce ,value 'simple-base-string)))))
+     (simple-string (vector-sap #!-sb-unicode (coerce ,value 'simple-base-string)
+                                #!+sb-unicode (%deport-c-string ,value
+                                                (alien-c-string-type-external-format ,type))))))
+
 
-(/show0 "host-c-call.lisp 42")
+(/show0 "host-c-call.lisp 78")
 
 (define-alien-type-class (utf8-string :include pointer :include-args (to)))
 
Index: src/code/octets.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/octets.lisp,v
retrieving revision 1.13
diff -u -r1.13 octets.lisp
--- src/code/octets.lisp	22 Mar 2006 11:39:27 -0000	1.13
+++ src/code/octets.lisp	22 May 2006 21:25:28 -0000
@@ -641,16 +641,18 @@
 
 (defun default-external-format ()
   (or *default-external-format*
-      (let ((external-format #!-win32 (intern (or (sb!alien:alien-funcall
-                                                    (extern-alien
-                                                      "nl_langinfo"
-                                                      (function c-string int))
-                                                    sb!unix:codeset)
-                                                  "LATIN-1")
-                                              "KEYWORD")
-                             #!+win32
-                               #!+sb-unicode (sb!win32::ansi-codepage)
-                               #!-sb-unicode :LATIN-1))
+      (let ((external-format
+	      #!-win32
+	      (let ((*default-external-format* :LATIN-1))
+		(intern (or (sb!alien:alien-funcall
+			      (extern-alien "nl_langinfo"
+					    (function c-string int))
+			      sb!unix:codeset)
+			    "LATIN-1")
+			"KEYWORD"))
+	      #!+win32
+	        #!+sb-unicode (sb!win32::ansi-codepage)
+		#!-sb-unicode :LATIN-1))
         (/show0 "cold-printing defaulted external-format:")
         #!+sb-show
         (cold-print external-format)
@@ -673,14 +675,14 @@
 ;;; FIXME: OAOOM here vrt. DEFINE-EXTERNAL-FORMAT in fd-stream.lisp
 (defparameter *external-format-functions*
   '(((:ascii :us-ascii :ansi_x3.4-1968 :iso-646 :iso-646-us :|646|)
-     ascii->string-aref string->ascii)
+     ascii->string-aref string->ascii ascii->string-sap-ref-8)
     ((:latin1 :latin-1 :iso-8859-1 :iso8859-1)
-     latin1->string-aref string->latin1)
+     latin1->string-aref string->latin1 latin1->string-sap-ref-8)
     #!+sb-unicode
     ((:latin9 :latin-9 :iso-8859-15 :iso8859-15)
-     latin9->string-aref string->latin9)
+     latin9->string-aref string->latin9 latin9->string-sap-ref-8)
     ((:utf8 :utf-8)
-     utf8->string-aref string->utf8)))
+     utf8->string-aref string->utf8 utf8->string-sap-ref-8)))
 
 (defun external-formats-funs (external-format)
   (when (eql external-format :default)
Index: src/code/target-c-call.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/target-c-call.lisp,v
retrieving revision 1.16
diff -u -r1.16 target-c-call.lisp
--- src/code/target-c-call.lisp	13 Jan 2006 11:32:46 -0000	1.16
+++ src/code/target-c-call.lisp	22 May 2006 21:25:29 -0000
@@ -46,17 +46,38 @@
 ;;; so the string can't move by virtue of pointers to it from
 ;;; outside the heap. Other platforms will access the lisp string
 ;;; through the GC-safe interior pointer. -- JES, 2006-01-13
-(defun %naturalize-c-string (sap)
+(eval-when (#+sb-xc :compile-toplevel)
+
+(defun alien-external-format () :LATIN-1))
+
+(eval-when (#-sb-xc :compile-toplevel :execute :load-toplevel)
+
+(defun alien-external-format ()
+  (or *alien-external-format*
+      (setf *alien-external-format* (sb!impl::default-external-format)))))
+
+(defun %naturalize-c-string (sap #!+sb-unicode external-format)
   (declare (type system-area-pointer sap))
   (locally
       (declare (optimize (speed 3) (safety 0)))
     (let ((length (loop for offset of-type fixnum upfrom 0
                         until (zerop (sap-ref-8 sap offset))
                         finally (return offset))))
+      #!+sb-unicode
+      (funcall (symbol-function (third (sb!impl::external-formats-funs external-format)))
+               sap 0 length)
+      #!-sb-unicode
       (let ((result (make-string length :element-type 'base-char)))
         (sb!kernel:copy-ub8-from-system-area sap 0 result 0 length)
         result))))
 
+#!+sb-unicode
+(defun %deport-c-string (string external-format)
+  (declare (type simple-string string))
+  (sb!impl::string-to-octets string
+                             :external-format external-format
+                             :null-terminate t))
+
 (defun %naturalize-utf8-string (sap)
   (declare (type system-area-pointer sap))
   (locally
Index: src/code/external-formats/enc-cyr.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/external-formats/enc-cyr.lisp,v
retrieving revision 1.3
diff -u -r1.3 enc-cyr.lisp
--- src/code/external-formats/enc-cyr.lisp	28 Jan 2006 08:52:35 -0000	1.3
+++ src/code/external-formats/enc-cyr.lisp	22 May 2006 21:25:47 -0000
@@ -161,7 +161,7 @@
 (instantiate-octets-definition define-koi8-r->string)
 
 (push '((:koi8-r :|koi8-r|)
-        koi8-r->string-aref string->koi8-r)
+        koi8-r->string-aref string->koi8-r koi8-r->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:koi8-r :|koi8-r|)
@@ -336,7 +336,7 @@
 (instantiate-octets-definition define-koi8-u->string)
 
 (push '((:koi8-u :|koi8-u|)
-        koi8-u->string-aref string->koi8-u)
+        koi8-u->string-aref string->koi8-u koi8-u->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:koi8-u :|koi8-u|)
@@ -506,7 +506,7 @@
 (instantiate-octets-definition define-x-mac-cyrillic->string)
 
 (push '((:x-mac-cyrillic :|x-mac-cyrillic|)
-        x-mac-cyrillic->string-aref string->x-mac-cyrillic)
+        x-mac-cyrillic->string-aref string->x-mac-cyrillic x-mac-cyrillic->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:x-mac-cyrillic :|x-mac-cyrillic|)
Index: src/code/external-formats/enc-dos.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/external-formats/enc-dos.lisp,v
retrieving revision 1.3
diff -u -r1.3 enc-dos.lisp
--- src/code/external-formats/enc-dos.lisp	28 Jan 2006 08:52:35 -0000	1.3
+++ src/code/external-formats/enc-dos.lisp	22 May 2006 21:25:57 -0000
@@ -161,7 +161,7 @@
 (instantiate-octets-definition define-cp437->string)
 
 (push '((:cp437 :|cp437|)
-        cp437->string-aref string->cp437)
+        cp437->string-aref string->cp437 cp437->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp437 :|cp437|)
@@ -336,7 +336,7 @@
 (instantiate-octets-definition define-cp850->string)
 
 (push '((:cp850 :|cp850|)
-        cp850->string-aref string->cp850)
+        cp850->string-aref string->cp850 cp850->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp850 :|cp850|)
@@ -511,7 +511,7 @@
 (instantiate-octets-definition define-cp852->string)
 
 (push '((:cp852 :|cp852|)
-        cp852->string-aref string->cp852)
+        cp852->string-aref string->cp852 cp852->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp852 :|cp852|)
@@ -686,7 +686,7 @@
 (instantiate-octets-definition define-cp855->string)
 
 (push '((:cp855 :|cp855|)
-        cp855->string-aref string->cp855)
+        cp855->string-aref string->cp855 cp855->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp855 :|cp855|)
@@ -860,7 +860,7 @@
 (instantiate-octets-definition define-cp857->string)
 
 (push '((:cp857 :|cp857|)
-        cp857->string-aref string->cp857)
+        cp857->string-aref string->cp857 cp857->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp857 :|cp857|)
@@ -1035,7 +1035,7 @@
 (instantiate-octets-definition define-cp860->string)
 
 (push '((:cp860 :|cp860|)
-        cp860->string-aref string->cp860)
+        cp860->string-aref string->cp860 cp860->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp860 :|cp860|)
@@ -1210,7 +1210,7 @@
 (instantiate-octets-definition define-cp861->string)
 
 (push '((:cp861 :|cp861|)
-        cp861->string-aref string->cp861)
+        cp861->string-aref string->cp861 cp861->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp861 :|cp861|)
@@ -1385,7 +1385,7 @@
 (instantiate-octets-definition define-cp862->string)
 
 (push '((:cp862 :|cp862|)
-        cp862->string-aref string->cp862)
+        cp862->string-aref string->cp862 cp862->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp862 :|cp862|)
@@ -1560,7 +1560,7 @@
 (instantiate-octets-definition define-cp863->string)
 
 (push '((:cp863 :|cp863|)
-        cp863->string-aref string->cp863)
+        cp863->string-aref string->cp863 cp863->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp863 :|cp863|)
@@ -1732,7 +1732,7 @@
 (instantiate-octets-definition define-cp864->string)
 
 (push '((:cp864 :|cp864|)
-        cp864->string-aref string->cp864)
+        cp864->string-aref string->cp864 cp864->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp864 :|cp864|)
@@ -1907,7 +1907,7 @@
 (instantiate-octets-definition define-cp865->string)
 
 (push '((:cp865 :|cp865|)
-        cp865->string-aref string->cp865)
+        cp865->string-aref string->cp865 cp865->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp865 :|cp865|)
@@ -2082,7 +2082,7 @@
 (instantiate-octets-definition define-cp866->string)
 
 (push '((:cp866 :|cp866|)
-        cp866->string-aref string->cp866)
+        cp866->string-aref string->cp866 cp866->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp866 :|cp866|)
@@ -2257,7 +2257,7 @@
 (instantiate-octets-definition define-cp869->string)
 
 (push '((:cp869 :|cp869|)
-        cp869->string-aref string->cp869)
+        cp869->string-aref string->cp869 cp869->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp869 :|cp869|)
@@ -2431,7 +2431,7 @@
 (instantiate-octets-definition define-cp874->string)
 
 (push '((:cp874 :|cp874|)
-        cp874->string-aref string->cp874)
+        cp874->string-aref string->cp874 cp874->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp874 :|cp874|)
Index: src/code/external-formats/enc-iso.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/external-formats/enc-iso.lisp,v
retrieving revision 1.4
diff -u -r1.4 enc-iso.lisp
--- src/code/external-formats/enc-iso.lisp	28 Jan 2006 08:52:35 -0000	1.4
+++ src/code/external-formats/enc-iso.lisp	22 May 2006 21:26:01 -0000
@@ -90,7 +90,7 @@
 (instantiate-octets-definition define-iso-8859-2->string)
 
 (push '((:iso-8859-2 :|iso-8859-2| :latin-2 :|latin-2|)
-        iso-8859-2->string-aref string->iso-8859-2)
+        iso-8859-2->string-aref string->iso-8859-2 iso-8859-2->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-2 :|iso-8859-2| :latin-2 :|latin-2|)
@@ -172,7 +172,7 @@
 (instantiate-octets-definition define-iso-8859-3->string)
 
 (push '((:iso-8859-3 :|iso-8859-3| :latin-3 :|latin-3|)
-        iso-8859-3->string-aref string->iso-8859-3)
+        iso-8859-3->string-aref string->iso-8859-3 iso-8859-3->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-3 :|iso-8859-3| :latin-3 :|latin-3|)
@@ -269,7 +269,7 @@
 (instantiate-octets-definition define-iso-8859-4->string)
 
 (push '((:iso-8859-4 :|iso-8859-4| :latin-4 :|latin-4|)
-        iso-8859-4->string-aref string->iso-8859-4)
+        iso-8859-4->string-aref string->iso-8859-4 iso-8859-4->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-4 :|iso-8859-4| :latin-4 :|latin-4|)
@@ -410,7 +410,7 @@
 (instantiate-octets-definition define-iso-8859-5->string)
 
 (push '((:iso-8859-5 :|iso-8859-5|)
-        iso-8859-5->string-aref string->iso-8859-5)
+        iso-8859-5->string-aref string->iso-8859-5 iso-8859-5->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-5 :|iso-8859-5|)
@@ -550,7 +550,7 @@
 (instantiate-octets-definition define-iso-8859-6->string)
 
 (push '((:iso-8859-6 :|iso-8859-6|)
-        iso-8859-6->string-aref string->iso-8859-6)
+        iso-8859-6->string-aref string->iso-8859-6 iso-8859-6->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-6 :|iso-8859-6|)
@@ -677,7 +677,7 @@
 (instantiate-octets-definition define-iso-8859-7->string)
 
 (push '((:iso-8859-7 :|iso-8859-7|)
-        iso-8859-7->string-aref string->iso-8859-7)
+        iso-8859-7->string-aref string->iso-8859-7 iso-8859-7->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-7 :|iso-8859-7|)
@@ -793,7 +793,7 @@
 (instantiate-octets-definition define-iso-8859-8->string)
 
 (push '((:iso-8859-8 :|iso-8859-8|)
-        iso-8859-8->string-aref string->iso-8859-8)
+        iso-8859-8->string-aref string->iso-8859-8 iso-8859-8->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-8 :|iso-8859-8|)
@@ -846,7 +846,7 @@
 (instantiate-octets-definition define-iso-8859-9->string)
 
 (push '((:iso-8859-9 :|iso-8859-9| :latin-5 :|latin-5|)
-        iso-8859-9->string-aref string->iso-8859-9)
+        iso-8859-9->string-aref string->iso-8859-9 iso-8859-9->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-9 :|iso-8859-9| :latin-5 :|latin-5|)
@@ -939,7 +939,7 @@
 (instantiate-octets-definition define-iso-8859-10->string)
 
 (push '((:iso-8859-10 :|iso-8859-10| :latin-6 :|latin-6|)
-        iso-8859-10->string-aref string->iso-8859-10)
+        iso-8859-10->string-aref string->iso-8859-10 iso-8859-10->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-10 :|iso-8859-10| :latin-6 :|latin-6|)
@@ -1081,7 +1081,7 @@
 (instantiate-octets-definition define-iso-8859-11->string)
 
 (push '((:iso-8859-11 :|iso-8859-11|)
-        iso-8859-11->string-aref string->iso-8859-11)
+        iso-8859-11->string-aref string->iso-8859-11 iso-8859-11->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-11 :|iso-8859-11|)
@@ -1184,7 +1184,7 @@
 (instantiate-octets-definition define-iso-8859-13->string)
 
 (push '((:iso-8859-13 :|iso-8859-13| :latin-7 :|latin-7|)
-        iso-8859-13->string-aref string->iso-8859-13)
+        iso-8859-13->string-aref string->iso-8859-13 iso-8859-13->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-13 :|iso-8859-13| :latin-7 :|latin-7|)
@@ -1262,7 +1262,7 @@
 (instantiate-octets-definition define-iso-8859-14->string)
 
 (push '((:iso-8859-14 :|iso-8859-14| :latin-8 :|latin-8|)
-        iso-8859-14->string-aref string->iso-8859-14)
+        iso-8859-14->string-aref string->iso-8859-14 iso-8859-14->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:iso-8859-14 :|iso-8859-14| :latin-8 :|latin-8|)
Index: src/code/external-formats/enc-win.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/external-formats/enc-win.lisp,v
retrieving revision 1.3
diff -u -r1.3 enc-win.lisp
--- src/code/external-formats/enc-win.lisp	28 Jan 2006 08:52:35 -0000	1.3
+++ src/code/external-formats/enc-win.lisp	22 May 2006 21:26:08 -0000
@@ -112,7 +112,7 @@
 (instantiate-octets-definition define-cp1250->string)
 
 (push '((:cp1250 :|cp1250| :windows-1250 :|windows-1250|)
-        cp1250->string-aref string->cp1250)
+        cp1250->string-aref string->cp1250 cp1250->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1250 :|cp1250| :windows-1250 :|windows-1250|)
@@ -272,7 +272,7 @@
 (instantiate-octets-definition define-cp1251->string)
 
 (push '((:cp1251 :|cp1251|  :windows-1251 :|windows-1251|)
-        cp1251->string-aref string->cp1251)
+        cp1251->string-aref string->cp1251 cp1251->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1251 :|cp1251| :windows-1251 :|windows-1251|)
@@ -351,7 +351,7 @@
 (instantiate-octets-definition define-cp1252->string)
 
 (push '((:cp1252 :|cp1252| :windows-1252 :|windows-1252|)
-        cp1252->string-aref string->cp1252)
+        cp1252->string-aref string->cp1252 cp1252->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1252 :|cp1252| :windows-1252 :|windows-1252|)
@@ -505,7 +505,7 @@
 (instantiate-octets-definition define-cp1253->string)
 
 (push '((:cp1253 :|cp1253| :windows-1253 :|windows-1253|)
-        cp1253->string-aref string->cp1253)
+        cp1253->string-aref string->cp1253 cp1253->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1253 :|cp1253| :windows-1253 :|windows-1253|)
@@ -590,7 +590,7 @@
 (instantiate-octets-definition define-cp1254->string)
 
 (push '((:cp1254 :|cp1254| :windows-1254 :|windows-1254|)
-        cp1254->string-aref string->cp1254)
+        cp1254->string-aref string->cp1254 cp1254->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1254 :|cp1254|)
@@ -736,7 +736,7 @@
 (instantiate-octets-definition define-cp1255->string)
 
 (push '((:cp1255 :|cp1255| :windows-1255 :|windows-1255|)
-        cp1255->string-aref string->cp1255)
+        cp1255->string-aref string->cp1255 cp1255->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1255 :|cp1255| :windows-1255 :|windows-1255|)
@@ -868,7 +868,7 @@
 (instantiate-octets-definition define-cp1256->string)
 
 (push '((:cp1256 :|cp1256| :windows-1256 :|windows-1256|)
-        cp1256->string-aref string->cp1256)
+        cp1256->string-aref string->cp1256 cp1256->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1256 :|cp1256|)
@@ -1002,7 +1002,7 @@
 (instantiate-octets-definition define-cp1257->string)
 
 (push '((:cp1257 :|cp1257| :windows-1257 :|windows-1257|)
-        cp1257->string-aref string->cp1257)
+        cp1257->string-aref string->cp1257 cp1257->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1257 :|cp1257| :windows-1257 :|windows-1257|)
@@ -1095,7 +1095,7 @@
 (instantiate-octets-definition define-cp1258->string)
 
 (push '((:cp1258 :|cp1258| :windows-1258 :|windows-1258|)
-        cp1258->string-aref string->cp1258)
+        cp1258->string-aref string->cp1258 cp1258->string-sap-ref-8)
       *external-format-functions*)
 
 (define-external-format (:cp1258 :|cp1258| :windows-1258 :|windows-1258|)
Index: src/code/external-formats/eucjp.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/code/external-formats/eucjp.lisp,v
retrieving revision 1.2
diff -u -r1.2 eucjp.lisp
--- src/code/external-formats/eucjp.lisp	4 Nov 2005 12:51:17 -0000	1.2
+++ src/code/external-formats/eucjp.lisp	22 May 2006 21:26:37 -0000
@@ -13289,5 +13289,5 @@
 (instantiate-octets-definition define-eucjp->string)
 
 (push '((:euc-jp :eucjp :|eucJP|)
-        eucjp->string-aref string->eucjp)
+        eucjp->string-aref string->eucjp eucjp->string-sap-ref-8)
       *external-format-functions*)
