p4raw-id: //depot/perl@24270
if (lenp) {
found = FALSE;
start = s;
- if (utf8_mg_pos(sv, &mg, &cache, 2, lenp, *lenp + *offsetp, &s, start, send)) {
+ if (utf8_mg_pos(sv, &mg, &cache, 2, lenp, *lenp, &s, start, send)) {
*lenp -= boffset;
found = TRUE;
}
#!./perl
-print "1..190\n";
+print "1..192\n";
#P = start of string Q = start of substr R = end of substr S = end of string
substr($a, -1) &= chr(0xfeff);
ok 190, $a eq "\xbf";
}
+
+# [perl #34976] incorrect caching of utf8 substr length
+{
+ my $a = "abcd\x{100}";
+ ok 191, substr($a,1,2) eq 'bc';
+ ok 192, substr($a,1,1) eq 'b';
+}