else { /* Note: mark already snarfed by pp_list */
SV *tmpstr = POPs;
STRLEN len;
- bool isutf = SvUTF8(tmpstr) ? TRUE : FALSE;
+ bool isutf = DO_UTF8(tmpstr);
SvSetSV(TARG, tmpstr);
SvPV_force(TARG, len);
tmps = SvPVX(TARG);
*tmps++ = value;
*tmps = '\0';
- SvUTF8_off(TARG); /* decontaminate */
(void)SvPOK_only(TARG);
XPUSHs(TARG);
RETURN;
}
*d = '\0';
SvCUR_set(TARG, d - SvPVX(TARG));
- (void)SvPOK_only(TARG);
+ (void)SvPOK_only_UTF8(TARG);
}
else
sv_setpvn(TARG, s, len);
*up++ = *down;
*down-- = tmp;
}
- (void)SvPOK_only(TARG);
+ (void)SvPOK_only_UTF8(TARG);
}
SP = MARK + 1;
SETTARG;
SvPV_set(dstr, SvPVX(sstr));
SvLEN_set(dstr, SvLEN(sstr));
SvCUR_set(dstr, SvCUR(sstr));
- if (SvUTF8(sstr))
- SvUTF8_on(dstr);
- else
- SvUTF8_off(dstr);
SvTEMP_off(dstr);
(void)SvOK_off(sstr); /* NOTE: nukes most SvFLAGS on sstr */
*SvEND(dstr) = '\0';
(void)SvPOK_only(dstr);
}
- if (DO_UTF8(sstr))
+ if ((sflags & SVf_UTF8) && !IN_BYTE)
SvUTF8_on(dstr);
/*SUPPRESS 560*/
if (sflags & SVp_NOK) {
require Config; import Config;
}
-print "1..15\n";
+print "1..17\n";
if ($Config{ebcdic} eq 'define') {
$_=join "", map chr($_), 129..233;
# 105 characters - 52 letters = 53 backslashes
# 105 characters + 53 backslashes = 158 characters
- $_=quotemeta $_;
+ $_= quotemeta $_;
if ( length == 158 ){print "ok 1\n"} else {print "not ok 1\n"}
# 104 non-backslash characters
if (tr/\\//cd == 104){print "ok 2\n"} else {print "not ok 2\n"}
# 96 characters - 52 letters - 10 digits - 1 underscore = 33 backslashes
# 96 characters + 33 backslashes = 129 characters
- $_=quotemeta $_;
+ $_= quotemeta $_;
if ( length == 129 ){print "ok 1\n"} else {print "not ok 1\n"}
# 95 non-backslash characters
if (tr/\\//cd == 95){print "ok 2\n"} else {print "not ok 2\n"}
print "\Q\l\UPe*x*r\El\E*" eq "pE\\*X\\*Rl*" ? "ok 13\n" : "not ok 13 \n";
print "\U\lPerl\E\E\E\E" eq "pERL" ? "ok 14\n" : "not ok 14 \n";
print "\l\UPerl\E\E\E\E" eq "pERL" ? "ok 15\n" : "not ok 15 \n";
+
+print length(quotemeta("\x{263a}")) == 1 ? "ok 16\n" : "not ok 16\n";
+print quotemeta("\x{263a}") eq "\x{263a}" ? "ok 17\n" : "not ok 17\n";
+#!./perl
-print "1..130\n";
+print "1..132\n";
#P = start of string Q = start of substr R = end of substr S = end of string
BEGIN {
- unshift @INC, '../lib' if -d '../lib' ;
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
}
use warnings ;
# utf8 sanity
{
my $x = substr("a\x{263a}b",0);
- ok 126, length($x) eq 3;
+ ok 126, length($x) == 3;
$x = substr($x,1,1);
ok 127, $x eq "\x{263a}";
$x = $x x 2;
- ok 128, length($x) eq 2;
+ ok 128, length($x) == 2;
substr($x,0,1) = "abcd";
ok 129, $x eq "abcd\x{263a}";
- ok 130, length($x) eq 5;
+ ok 130, length($x) == 5;
+ $x = reverse $x;
+ ok 131, length($x) == 5;
+ ok 132, $x eq "\x{263a}dcba";
}
NV nshift = 1.0;
STRLEN len;
char *start = SvPVx(sv,len);
- bool utf = SvUTF8(sv);
+ bool utf = SvUTF8(sv) ? TRUE : FALSE;
char *end = start + len;
while (start < end) {
I32 skip;