diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-03-18 11:43:42 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-08-29 09:56:03 -0600 |
commit | 9ff2f0f7573fbc9494fcb894aa1f3351a2c7985d (patch) | |
tree | dce923b77eaf00e620bc68c3c47a04667e0ad08b | |
parent | 4937f588b80a1b766e4edd8d2f246e3b72ffb7b8 (diff) | |
download | perl-9ff2f0f7573fbc9494fcb894aa1f3351a2c7985d.tar.gz |
Fix valid_utf8_to_uvchr() for EBCDIC
-rw-r--r-- | utf8.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -936,7 +936,7 @@ Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) { UV expectlen = UTF8SKIP(s); const U8* send = s + expectlen; - UV uv = NATIVE_UTF8_TO_I8(*s); + UV uv = *s; PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR; @@ -946,9 +946,13 @@ Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) /* An invariant is trivially returned */ if (expectlen == 1) { - return LATIN1_TO_NATIVE(uv); + return uv; } +#ifdef EBCDIC + uv = NATIVE_UTF8_TO_I8(uv); +#endif + /* Remove the leading bits that indicate the number of bytes, leaving just * the bits that are part of the value */ uv &= UTF_START_MASK(expectlen); |