diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-10-08 08:52:39 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-10-08 08:52:39 +0000 |
commit | 1de9afcdf18cf98bbdecaa782da93e907be6fe4e (patch) | |
tree | fa4216763e721c277c0a2f329129782277742970 /utf8.c | |
parent | 59910b6dbc5bdf043d9f33f40bbbc9957f008770 (diff) | |
download | perl-1de9afcdf18cf98bbdecaa782da93e907be6fe4e.tar.gz |
Make the perl interpreter more tolerant of UTF-16-encoded script
(patch by Jarkko Hietaniemi)
p4raw-id: //depot/perl@23351
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; |