diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-07 05:39:55 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-07 05:39:55 +0000 |
commit | 7f66633bd788f56bb4e77473ec86f45e8cc0614b (patch) | |
tree | 9acfaccce4b612cbcc1a6848ccafa4c1f7acb1dc /pp.c | |
parent | 277ddfaf09c11f4f38a1c6f63c004bfe4d066e3d (diff) | |
download | perl-7f66633bd788f56bb4e77473ec86f45e8cc0614b.tar.gz |
substr() does not preserve utf8-ness (from Stefan Eissing
<Eissing@medicaldataservice.de>); added tests
p4raw-id: //depot/perl@6084
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2008,12 +2008,12 @@ PP(pp_substr) RETPUSHUNDEF; } else { - if (utfcurlen) { + if (utfcurlen) sv_pos_u2b(sv, &pos, &rem); - SvUTF8_on(TARG); - } tmps += pos; sv_setpvn(TARG, tmps, rem); + if (utfcurlen) + SvUTF8_on(TARG); if (repl) sv_insert(sv, pos, rem, repl, repl_len); else if (lvalue) { /* it's an lvalue! */ @@ -2026,7 +2026,7 @@ PP(pp_substr) "Attempt to use reference as lvalue in substr"); } if (SvOK(sv)) /* is it defined ? */ - (void)SvPOK_only(sv); + (void)SvPOK_only_UTF8(sv); else sv_setpvn(sv,"",0); /* avoid lexical reincarnation */ } |