From: Jarkko Hietaniemi Date: Sun, 16 Dec 2001 15:34:52 +0000 (+0000) Subject: Make surrogates illegal also on EBCDIC. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bd23935f1e5b7c6f7035440f4b48e4c9659d61f;p=p5sagit%2Fp5-mst-13.2.git Make surrogates illegal also on EBCDIC. p4raw-id: //depot/perl@13721 --- diff --git a/utf8.c b/utf8.c index f21b13c..517b2e3 100644 --- a/utf8.c +++ b/utf8.c @@ -50,6 +50,8 @@ Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) *d++ = UTF_TO_NATIVE(uv); return d; } + if (UNICODE_IS_SURROGATE(uv)) + Perl_croak(aTHX_ "UTF-16 surrogate 0x%04"UVxf, uv); #if defined(EBCDIC) else { STRLEN len = UNISKIP(uv); @@ -68,8 +70,6 @@ Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) return d; } if (uv < 0x10000) { - if (UNICODE_IS_SURROGATE(uv)) - Perl_croak(aTHX_ "UTF-16 surrogate 0x%04"UVxf, uv); *d++ = (( uv >> 12) | 0xe0); *d++ = (((uv >> 6) & 0x3f) | 0x80); *d++ = (( uv & 0x3f) | 0x80);