From: Simon Cozens Date: Thu, 14 Sep 2000 20:59:19 +0000 (+0100) Subject: UTF8-encoded version of 256 is 0xc4 0x80; test that a char is X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3282e3a65f9bcf8c13ecb7e0f06da5d5fb020fef;p=p5sagit%2Fp5-mst-13.2.git UTF8-encoded version of 256 is 0xc4 0x80; test that a char is convertible to bytes by checking it doesn't go above 0xc3 Subject: Re: perl@7078 Message-ID: <20000914205919.A11098@deep-dark-truthful-mirror.perlhacker.org> p4raw-id: //depot/perl@7084 --- diff --git a/utf8.c b/utf8.c index d97a8b0..6ae92bd 100644 --- a/utf8.c +++ b/utf8.c @@ -299,8 +299,7 @@ Perl_utf8_to_bytes(pTHX_ U8* s, STRLEN *len) /* ensure valid UTF8 and chars < 256 before updating string */ while (s < send) { U8 c = *s++; - if (c >= 0x80 && - ( (s >= send) || ((*s++ & 0xc0) != 0x80) || ((c & 0xfe) != 0xc2))) { + if ( (s >= send) || (*s & 0x80 && c > 0xc3)) { *len = -1; return 0; }