summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-03-18 11:43:42 -0600
committerKarl Williamson <public@khwilliamson.com>2013-08-29 09:56:03 -0600
commit9ff2f0f7573fbc9494fcb894aa1f3351a2c7985d (patch)
treedce923b77eaf00e620bc68c3c47a04667e0ad08b /utf8.c
parent4937f588b80a1b766e4edd8d2f246e3b72ffb7b8 (diff)
downloadperl-9ff2f0f7573fbc9494fcb894aa1f3351a2c7985d.tar.gz
Fix valid_utf8_to_uvchr() for EBCDIC
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/utf8.c b/utf8.c
index e9b0f5cd28..fb3934c2b0 100644
--- a/utf8.c
+++ b/utf8.c
@@ -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);