summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-04-06 16:41:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-04-06 16:41:06 +0000
commitc867b36081026b7a72e449b72b5b9916973f9bf1 (patch)
treef6fcb143698c8b8f947a0028f8838bb476b2b2fb /utf8.c
parent37361303e31c2073b3e9c4c5bce1a4cc42832f83 (diff)
downloadperl-c867b36081026b7a72e449b72b5b9916973f9bf1.tar.gz
As noted by Philip Newton: nothing wrong with BOM,
but 0xFFFE quite wrong. p4raw-id: //depot/perl@15762
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/utf8.c b/utf8.c
index 0100eb17a7..9f2c4fb2ca 100644
--- a/utf8.c
+++ b/utf8.c
@@ -64,10 +64,7 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
((uv >= 0xFDD0 && uv <= 0xFDEF &&
!(flags & UNICODE_ALLOW_FDD0))
||
- (UNICODE_IS_BYTE_ORDER_MARK(uv) &&
- !(flags & UNICODE_ALLOW_BOM))
- ||
- ((uv & 0xFFFF) == 0xFFFF &&
+ ((uv & 0xFFFE) == 0xFFFE && /* Either FFFE or FFFF. */
!(flags & UNICODE_ALLOW_FFFF))) &&
/* UNICODE_ALLOW_SUPER includes
* FFFFs beyond 0x10FFFF. */
@@ -296,9 +293,8 @@ Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
#define UTF8_WARN_SHORT 5
#define UTF8_WARN_OVERFLOW 6
#define UTF8_WARN_SURROGATE 7
-#define UTF8_WARN_BOM 8
-#define UTF8_WARN_LONG 9
-#define UTF8_WARN_FFFF 10
+#define UTF8_WARN_LONG 8
+#define UTF8_WARN_FFFF 9 /* Also FFFE. */
if (curlen == 0 &&
!(flags & UTF8_ALLOW_EMPTY)) {
@@ -393,10 +389,6 @@ Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
!(flags & UTF8_ALLOW_SURROGATE)) {
warning = UTF8_WARN_SURROGATE;
goto malformed;
- } else if (UNICODE_IS_BYTE_ORDER_MARK(uv) &&
- !(flags & UTF8_ALLOW_BOM)) {
- warning = UTF8_WARN_BOM;
- goto malformed;
} else if ((expectlen > UNISKIP(uv)) &&
!(flags & UTF8_ALLOW_LONG)) {
warning = UTF8_WARN_LONG;
@@ -452,9 +444,6 @@ malformed:
case UTF8_WARN_SURROGATE:
Perl_sv_catpvf(aTHX_ sv, "(UTF-16 surrogate 0x%04"UVxf")", uv);
break;
- case UTF8_WARN_BOM:
- Perl_sv_catpvf(aTHX_ sv, "(byte order mark 0x%04"UVxf")", uv);
- break;
case UTF8_WARN_LONG:
Perl_sv_catpvf(aTHX_ sv, "(%d byte%s, need %d, after start byte 0x%02"UVxf")",
expectlen, expectlen == 1 ? "": "s", UNISKIP(uv), startbyte);