summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-10-08 08:52:39 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-10-08 08:52:39 +0000
commit1de9afcdf18cf98bbdecaa782da93e907be6fe4e (patch)
treefa4216763e721c277c0a2f329129782277742970 /utf8.c
parent59910b6dbc5bdf043d9f33f40bbbc9957f008770 (diff)
downloadperl-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.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utf8.c b/utf8.c
index 24bf93d9d7..f12696ecf1 100644
--- 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;