This file contains various utility functions for manipulating UTF8-encoded
strings. For the uninitiated, this is a method of representing arbitrary
-Unicde characters as a variable number of bytes, in such a way that
-characters in the ASCII range are unmodifed, and a zero byte never appears.
+Unicode characters as a variable number of bytes, in such a way that
+characters in the ASCII range are unmodified, and a zero byte never appears
+within non-zero characters.
=for apidoc A|U8 *|uvuni_to_utf8_flags|U8 *d|UV uv|UV flags
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;