Author: leo
Date: Tue Nov 15 04:33:18 2005
New Revision: 9981

Modified:
   trunk/encodings/utf16.c
Log:
charsets and encodings - fix latin1 -> utf16 conv



Modified: trunk/encodings/utf16.c
==============================================================================
--- trunk/encodings/utf16.c     (original)
+++ trunk/encodings/utf16.c     Tue Nov 15 04:33:18 2005
@@ -69,10 +69,10 @@ to_encoding(Interp *interpreter, STRING 
     else {
         result = dest;
     }
-    result->charset  = Parrot_unicode_charset_ptr;
-    result->encoding = Parrot_utf16_encoding_ptr;
-    result->strlen = src_len;
     if (!src_len) {
+        result->charset  = Parrot_unicode_charset_ptr;
+        result->encoding = Parrot_utf16_encoding_ptr;
+        result->strlen = src_len;
         result->encoding = Parrot_ucs2_encoding_ptr;
         return result;
     }
@@ -124,6 +124,9 @@ to_encoding(Interp *interpreter, STRING 
         memcpy(src->strstart, p, src->bufused);
         mem_sys_free(p);
     }
+    result->charset  = Parrot_unicode_charset_ptr;
+    result->encoding = Parrot_utf16_encoding_ptr;
+    result->strlen = src_len;
 
     /* downgrade if possible */
     if (dest_len == (int)src->strlen)

Reply via email to