Upgrade to Encode 2.08.
[p5sagit/p5-mst-13.2.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 24bf93d..f12696e 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -868,8 +868,14 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I32 bytelen, I32 *newlen)
     U8* pend;
     U8* dstart = d;
 
+    if (bytelen == 1 && p[0] == 0) { /* Be understanding. */
+        d[0] = 0;
+        *newlen = 1;
+        return d;
+    }
+
     if (bytelen & 1)
-       Perl_croak(aTHX_ "panic: utf16_to_utf8: odd bytelen");
+       Perl_croak(aTHX_ "panic: utf16_to_utf8: odd bytelen %d", bytelen);
 
     pend = p + bytelen;