diff options
author | Dan Kogai <dankogai@dan.co.jp> | 2002-10-22 02:36:02 +0900 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-10-24 23:36:48 +0000 |
commit | d0063567ae6829f18fa94be9ac4f0b3986e32f5a (patch) | |
tree | 63f390c01e731f401d0f2b5085864df3a6757bc4 /toke.c | |
parent | ab3374e4b7f0adca0bcf6e7b71aaacbfd7df7b07 (diff) | |
download | perl-d0063567ae6829f18fa94be9ac4f0b3986e32f5a.tar.gz |
The Inaba patch for tr/// vs. use encoding
Message-Id: <218B4434-E4D0-11D6-A668-0003939A104C@dan.co.jp>
p4raw-id: //depot/perl@18058
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1674,17 +1674,18 @@ S_scan_const(pTHX_ char *start) *d = '\0'; SvCUR_set(sv, d - SvPVX(sv)); if (SvCUR(sv) >= SvLEN(sv)) - Perl_croak(aTHX_ "panic: constant overflowed allocated space"); + Perl_croak(aTHX_ "panic: constant overflowed allocated space"); SvPOK_on(sv); if (PL_encoding && !has_utf8) { - sv_recode_to_utf8(sv, PL_encoding); - has_utf8 = TRUE; + sv_recode_to_utf8(sv, PL_encoding); + if (SvUTF8(sv)) + has_utf8 = TRUE; } if (has_utf8) { SvUTF8_on(sv); if (PL_lex_inwhat == OP_TRANS && PL_sublex_info.sub_op) { - PL_sublex_info.sub_op->op_private |= + PL_sublex_info.sub_op->op_private |= (PL_lex_repl ? OPpTRANS_FROM_UTF : OPpTRANS_TO_UTF); } } @@ -7032,6 +7033,9 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims) sv_catpvn(sv, s, 1); if (has_utf8) SvUTF8_on(sv); + else if (PL_encoding) + sv_recode_to_utf8(sv, PL_encoding); + PL_multi_end = CopLINE(PL_curcop); s++; |