summaryrefslogtreecommitdiff
path: root/utfebcdic.h
diff options
context:
space:
mode:
authorChristian Hansen <chansen@cpan.org>2012-04-18 14:32:16 -0600
committerKarl Williamson <public@khwilliamson.com>2012-04-26 11:58:56 -0600
commit0ae1fa71a437dfa435b139674610ec992366d661 (patch)
tree12faccc69cbd13481e4d3c2012a1855c835ab1a6 /utfebcdic.h
parentdd53ca2f01b45dd5a54bd2d00709dbfbe00ccdf3 (diff)
downloadperl-0ae1fa71a437dfa435b139674610ec992366d661.tar.gz
utf8.h: Use correct UTF-8 downgradeable definition
Previously, the macro changed by this commit would accept overlong sequences. This patch was changed by the committer to to include EBCDIC changes; and in the non-EBCDIC case, to save a test, by using a mask instead, in keeping with the prior version of the code
Diffstat (limited to 'utfebcdic.h')
-rw-r--r--utfebcdic.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/utfebcdic.h b/utfebcdic.h
index aa3304bf2a..b3b767df26 100644
--- a/utfebcdic.h
+++ b/utfebcdic.h
@@ -587,7 +587,7 @@ END_EXTERN_C
#define UTF8_IS_START(c) (NATIVE_TO_UTF(c) >= 0xA0 && (NATIVE_TO_UTF(c) & 0xE0) != 0xA0)
#define UTF8_IS_CONTINUATION(c) ((NATIVE_TO_UTF(c) & 0xE0) == 0xA0)
#define UTF8_IS_CONTINUED(c) (NATIVE_TO_UTF(c) >= 0xA0)
-#define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xA0 && (NATIVE_TO_UTF(c) & 0xF8) == 0xC0)
+#define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) <= 0xC7)
#define UTF_START_MARK(len) (((len) > 7) ? 0xFF : ((U8)(0xFE << (7-(len)))))
#define UTF_START_MASK(len) (((len) >= 6) ? 0x01 : (0x1F >> ((len)-2)))