Regression test from:
Subject: Re: [perl #29149] substr/UTF8 related problem with perl 5.8.3 on linux
Message-Id: <
20040429103926.5BA6.BQW10602@nifty.com>
Date: Thu, 29 Apr 2004 10:53:17 +0900
p4raw-id: //depot/perl@22755
s += UTF8SKIP(s);
if (s >= send)
s = send;
- if (utf8_mg_pos_init(sv, &mg, &cache, 2, lenp, s, start))
- cache[2] += *offsetp;
+ utf8_mg_pos_init(sv, &mg, &cache, 2, lenp, s, start);
}
*lenp = s - start;
}
cache[0] -= ubackw;
*offsetp = cache[0];
+
+ /* Drop the stale "length" cache */
+ cache[2] = 0;
+ cache[3] = 0;
+
return;
}
}
cache[0] = len;
cache[1] = *offsetp;
+ /* Drop the stale "length" cache */
+ cache[2] = 0;
+ cache[3] = 0;
}
*offsetp = len;
#!./perl
-print "1..188\n";
+print "1..189\n";
#P = start of string Q = start of substr R = end of substr S = end of string
$foo = '123456789';
ok 188, bar eq '123456789';
}
+
+# [perl #29149]
+{
+ my $text = "0123456789\xED ";
+ utf8::upgrade($text);
+ my $pos = 5;
+ pos($text) = $pos;
+ my $a = substr($text, $pos, $pos);
+ ok 189, substr($text,$pos,1) eq $pos;
+
+}