Index: /trunk/ccl/level-1/l1-unicode.lisp
===================================================================
--- /trunk/ccl/level-1/l1-unicode.lisp	(revision 6390)
+++ /trunk/ccl/level-1/l1-unicode.lisp	(revision 6391)
@@ -2700,5 +2700,5 @@
                        (locally
                            (declare (type (unsigned-byte 8) s2))
-                         (if (< s2 #xf0)
+                         (if (< 1st-unit #xf0)
                            (if (and (< (the fixnum (logxor s1 #x80)) #x40)
                                     (< (the fixnum (logxor s2 #x80)) #x40)
@@ -3276,5 +3276,5 @@
              (return (values nchars i))
              (setq i nexti nchars (1+ nchars)))))))
-    :literal-char-code-limit #x10000
+    :literal-char-code-limit #xd800    ; use separate encode/decode limits
     :nul-encoding #(0 0)
     )
@@ -3439,5 +3439,5 @@
            (return (values nchars i))
            (setq i nexti nchars (1+ nchars)))))))
-  :literal-char-code-limit #x10000
+  :literal-char-code-limit #xd800
   :nul-encoding #(0 0)
   )
@@ -3650,5 +3650,5 @@
                    2
                    4)))))))
-  :literal-char-code-limit #x10000
+  :literal-char-code-limit #xd800
   :use-byte-order-mark
   #+big-endian-target :utf-16le
