summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-05-07 05:39:55 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-05-07 05:39:55 +0000
commit7f66633bd788f56bb4e77473ec86f45e8cc0614b (patch)
tree9acfaccce4b612cbcc1a6848ccafa4c1f7acb1dc /pp.c
parent277ddfaf09c11f4f38a1c6f63c004bfe4d066e3d (diff)
downloadperl-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp.c b/pp.c
index a86be7ad3e..d2a8c64af4 100644
--- a/pp.c
+++ b/pp.c
@@ -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 */
}