From: Jarkko Hietaniemi Date: Wed, 31 Jan 2001 22:56:16 +0000 (+0000) Subject: Macrofy a magic UTF-8 test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df84a23b01be600297e1e5268d9351b807f107f6;p=p5sagit%2Fp5-mst-13.2.git Macrofy a magic UTF-8 test. p4raw-id: //depot/perl@8647 --- diff --git a/utf8.c b/utf8.c index 4555ecb..a36cc74 100644 --- a/utf8.c +++ b/utf8.c @@ -610,7 +610,7 @@ Perl_bytes_from_utf8(pTHX_ U8* s, STRLEN *len, bool *is_utf8) U8 c = *s++; if (!UTF8_IS_ASCII(c)) { if (UTF8_IS_CONTINUATION(c) || s >= send || - !UTF8_IS_CONTINUATION(*s) || (c & 0xfc) != 0xc0) + !UTF8_IS_CONTINUATION(*s) || UTF8_IS_DOWNGRADEABLE_START(c)) return start; s++, count++; } diff --git a/utf8.h b/utf8.h index 28aa057..00350f2 100644 --- a/utf8.h +++ b/utf8.h @@ -68,6 +68,7 @@ END_EXTERN_C #define UTF8_IS_START(c) (((U8)c) >= 0xc0 && (((U8)c) <= 0xfd)) #define UTF8_IS_CONTINUATION(c) (((U8)c) >= 0x80 && (((U8)c) <= 0xbf)) #define UTF8_IS_CONTINUED(c) (((U8)c) & 0x80) +#define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfc) != 0xc0) #define UTF8_CONTINUATION_MASK ((U8)0x3f) #define UTF8_ACCUMULATION_SHIFT 6