This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Remove remapping for EBCDIC for octal
authorKarl Williamson <public@khwilliamson.com>
Sun, 17 Feb 2013 20:50:45 +0000 (13:50 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 29 Aug 2013 15:55:52 +0000 (09:55 -0600)
The code prior to this commit converted something like \04 into its
EBCDIC equivalent only in double-quoted strings.  This was not done in
patterns, and so gave inconsistent results.  The correct thing to do
should be to do the native thing, what someone who works on a platform
would think \04 do.  Platform independent characters are available
through \N{}, either by name or by U+XXXX.

The comment changed by this was wrong, as in some cases it was native,
and in some cases Unicode.

toke.c

diff --git a/toke.c b/toke.c
index ab62548..9764ac4 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3371,7 +3371,7 @@ S_scan_const(pTHX_ char *start)
                {
                     I32 flags = PERL_SCAN_SILENT_ILLDIGIT;
                     STRLEN len = 3;
-                   uv = NATIVE_TO_UNI(grok_oct(s, &len, &flags, NULL));
+                   uv = grok_oct(s, &len, &flags, NULL);
                    s += len;
                     if (len < 3 && s < send && isDIGIT(*s)
                         && ckWARN(WARN_MISC))
@@ -3423,9 +3423,8 @@ S_scan_const(pTHX_ char *start)
                 * UTF-8 sequence they can end up as, except if they force us
                 * to recode the rest of the string into utf8 */
                
-               /* Here uv is the ordinal of the next character being added in
-                * unicode (converted from native). */
-               if (!UNI_IS_INVARIANT(uv)) {
+               /* Here uv is the ordinal of the next character being added */
+               if (!NATIVE_IS_INVARIANT(uv)) {
                    if (!has_utf8 && uv > 255) {
                        /* Might need to recode whatever we have accumulated so
                         * far if it contains any chars variant in utf8 or