This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Don't convert \x{} from native
authorKarl Williamson <public@khwilliamson.com>
Sun, 17 Jun 2012 18:33:10 +0000 (12:33 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 20 Jun 2012 20:08:40 +0000 (14:08 -0600)
This was and is a no-op on ASCII platforms, but on EBCDIC, when you did
e.g., a "\x{7}", it would convert that to a 127.  But it did not do this
on qr/\x{7}/, giving inconsistent results.  Now, \x{7} yields 7, and
thus is consistent, and matches the documentation.

toke.c

diff --git a/toke.c b/toke.c
index 779990e..dfcb25c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3040,14 +3040,14 @@ S_scan_const(pTHX_ char *start)
                        continue;
                    }
                     len = e - s;
-                   uv = NATIVE_TO_UNI(grok_hex(s, &len, &flags, NULL));
+                   uv = grok_hex(s, &len, &flags, NULL);
                    s = e + 1;
                }
                else {
                    {
                        STRLEN len = 2;
                         I32 flags = PERL_SCAN_DISALLOW_PREFIX;
-                       uv = NATIVE_TO_UNI(grok_hex(s, &len, &flags, NULL));
+                       uv = grok_hex(s, &len, &flags, NULL);
                        s += len;
                    }
                }