From: Jarkko Hietaniemi Date: Thu, 19 Apr 2001 12:13:29 +0000 (+0000) Subject: A better fix for the \x{12345678} trouble from NI-S. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6eb6869e2f02678a2e46aaaf15795b052fc0297b;p=p5sagit%2Fp5-mst-13.2.git A better fix for the \x{12345678} trouble from NI-S. p4raw-id: //depot/perl@9755 --- diff --git a/utf8.c b/utf8.c index 1694c0d..fda9920 100644 --- a/utf8.c +++ b/utf8.c @@ -163,20 +163,15 @@ Perl_is_utf8_char(pTHX_ U8 *s) slen = len - 1; s++; - /* The initial value is dubious */ + u &= UTF_START_MASK(len); uv = u; ouv = uv; while (slen--) { if (!UTF8_IS_CONTINUATION(*s)) return 0; uv = UTF8_ACCUMULATE(uv, *s); -#if 0 - /* Depending on the compiler the wrap of the value takig pladve - * between 5 and 6 bytes of UTF-8 encoding either works or not. - * See similar spot in utf8_to_uvuni(). --jhi */ if (uv < ouv) return 0; -#endif ouv = uv; s++; } @@ -347,14 +342,9 @@ Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) } } else { /* uv < ouv */ -#if 0 - /* Depending on the compiler the wrap of the value takig pladve - * between 5 and 6 bytes of UTF-8 encoding either works or not. - * See similar spot in is_utf8_char(). --jhi */ /* This cannot be allowed. */ warning = UTF8_WARN_OVERFLOW; goto malformed; -#endif } } s++;