From: Jarkko Hietaniemi Date: Sun, 4 Mar 2001 17:36:04 +0000 (+0000) Subject: More tr/// UTF-8 fixes from Inaba Hiroto. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94472101973f2669f5034174c504c45df6a04c85;p=p5sagit%2Fp5-mst-13.2.git More tr/// UTF-8 fixes from Inaba Hiroto. p4raw-id: //depot/perl@9015 --- diff --git a/doop.c b/doop.c index 7e2b52f..db5eeaf 100644 --- a/doop.c +++ b/doop.c @@ -491,11 +491,11 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) /* SPC - NOT OK */ } if (uv < none) { matches++; + s += UTF8SKIP(s); if (uv != puv) { d = uv_to_utf8(d, uv); puv = uv; } - s += UTF8SKIP(s); continue; } else if (uv == none) { /* "none" is unmapped character */ @@ -508,11 +508,11 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) /* SPC - NOT OK */ } else if (uv == extra && !del) { matches++; + s += UTF8SKIP(s); if (uv != puv) { d = uv_to_utf8(d, final); puv = final; } - s += UTF8SKIP(s); continue; } matches++; /* "none+1" is delete character */ @@ -546,8 +546,8 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) /* SPC - NOT OK */ } else if (uv == extra && !del) { matches++; - d = uv_to_utf8(d, final); s += UTF8SKIP(s); + d = uv_to_utf8(d, final); continue; } matches++; /* "none+1" is delete character */ diff --git a/t/op/tr.t b/t/op/tr.t index b10f4f2..eb5c4ca 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..55\n"; +print "1..57\n"; $_ = "abcdefghijklmnopqrstuvwxyz"; @@ -315,3 +315,13 @@ print "ok 54\n"; print "not " unless $a eq "X"; print "ok 55\n"; +# UTF8 range tests from Inaba Hiroto + +($a = "\x{200}") =~ tr/\x00-\x{100}/X/c; +print "not " unless $a eq "X"; +print "ok 56\n"; + +($a = "\x{200}") =~ tr/\x00-\x{100}/X/cs; +print "not " unless $a eq "X"; +print "ok 57\n"; +