summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-11-23 21:50:41 -0700
committerKarl Williamson <khw@cpan.org>2014-11-24 10:50:26 -0700
commit896eff3c48ae9560ce70fb8a9e729558e65592da (patch)
tree6808bd99b945db884c0cdc4ce79814648a9ece0d /toke.c
parentb64912e99f61d14bb5e6ec9388cee8affde67198 (diff)
downloadperl-896eff3c48ae9560ce70fb8a9e729558e65592da.tar.gz
toke.c: Ignore 'use encoding' on \N{}
The encoding pragma converts from a specified encoding into Unicode. \N{} already returns the Unicode form, so the encoding pragma should not operate on them. This commit ensures that. The only reason things have appeared to work prior to this commit is that \N{} has generally returned its value in UTF-8, which 'encoding' knows enough to not disturb. However, a custom name translator installed in the program need not return in UTF-8, so this is a bug that just hasn't yet been exposed. However, the next commit is about to change things so that a regular \N{} only returns UTF-8 if it has to, so this bug would come up a lot more often. There is no need for adding a test case, because, without this commit existing tests would fail in t/uni/greek.t.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index cb14570e6e..059c4636ae 100644
--- a/toke.c
+++ b/toke.c
@@ -3476,7 +3476,7 @@ S_scan_const(pTHX_ char *start)
d = off + SvGROW(sv, off + len + (STRLEN)(send - s) + 1);
}
if (! SvUTF8(res)) { /* Make sure \N{} return is UTF-8 */
- sv_utf8_upgrade(res);
+ sv_utf8_upgrade_flags(res, SV_UTF8_NO_ENCODING);
str = SvPV_const(res, len);
}
Copy(str, d, len, char);