Change 19640 by [EMAIL PROTECTED] on 2003/05/30 05:47:15

        Fix for "#22375 'split'/'index' problem for utf8".

Affected files ...

... //depot/perl/sv.c#662 edit
... //depot/perl/t/op/index.t#7 edit

Differences ...

==== //depot/perl/sv.c#662 (text) ====
Index: perl/sv.c
--- perl/sv.c#661~19505~        Mon May 12 14:49:21 2003
+++ perl/sv.c   Thu May 29 22:47:15 2003
@@ -5952,8 +5952,6 @@
                        }
 
                        cache[0] -= ubackw;
-
-                       return;
                    }
                }
            }

==== //depot/perl/t/op/index.t#7 (xtext) ====
Index: perl/t/op/index.t
--- perl/t/op/index.t#6~11686~  Wed Aug 15 17:20:40 2001
+++ perl/t/op/index.t   Thu May 29 22:47:15 2003
@@ -2,7 +2,7 @@
 
 # $RCSfile: index.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:59 $
 
-print "1..24\n";
+print "1..28\n";
 
 $foo = 'Now is the time for all good men to come to the aid of their country.';
 
@@ -47,3 +47,25 @@
 
 print rindex($a, "\x{1234}") == 4 ? "ok 23\n" : "not ok 23\n";
 print rindex($a, "foo",    ) == 0 ? "ok 24\n" : "not ok 24\n";
+
+{
+    # [perl #22375] 'split'/'index' problem for utf8
+    my $t = 25;
+    my $needle = "\x{1230}\x{1270}";
+    my @needles = split ( //, $needle );
+    my $haystack = "\x{1228}\x{1228}\x{1230}\x{1270}";
+    foreach ( @needles ) {
+       my $a = index ( "\x{1228}\x{1228}\x{1230}\x{1270}", $_ );
+       my $b = index ( $haystack, $_ );
+       print $a == $b ? "ok $t\n" : "not ok $t # - $a != $b\n";
+       $t++;
+    }
+    $needle = "\x{1270}\x{1230}"; # Transpose them.
+    @needles = split ( //, $needle );
+    foreach ( @needles ) {
+       my $a = index ( "\x{1228}\x{1228}\x{1230}\x{1270}", $_ );
+       my $b = index ( $haystack, $_ );
+       print $a == $b ? "ok $t\n" : "not ok $t # - $a != $b\n";
+       $t++;
+    }
+}
End of Patch.

Reply via email to