Change 14143 by jhi@alpha on 2002/01/09 01:32:05

        SANY (. with /s) wasn't happy on Unicode.

Affected files ...

.... //depot/perl/regexec.c#245 edit
.... //depot/perl/t/op/pat.t#147 edit

Differences ...

==== //depot/perl/regexec.c#245 (text) ====
Index: perl/regexec.c
--- perl/regexec.c.~1~  Tue Jan  8 18:45:06 2002
+++ perl/regexec.c      Tue Jan  8 18:45:06 2002
@@ -3877,7 +3877,15 @@
        }
        break;
     case SANY:
-       scan = loceol;
+        if (do_utf8) {
+           loceol = PL_regeol;
+           while (scan < loceol) {
+               scan += UTF8SKIP(scan);
+               hardcount++;
+           }
+       }
+       else
+           scan = loceol;
        break;
     case CANY:
        scan = loceol;

==== //depot/perl/t/op/pat.t#147 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t.~1~ Tue Jan  8 18:45:06 2002
+++ perl/t/op/pat.t     Tue Jan  8 18:45:06 2002
@@ -6,7 +6,7 @@
 
 $| = 1;
 
-print "1..843\n";
+print "1..845\n";
 
 BEGIN {
     chdir 't' if -d 't';
@@ -2620,3 +2620,21 @@
     print "<\x{2029}>" =~ /<\s>/ ? "ok 843\n" : "not ok 843\n";
 }
 
+{
+    print "# . with /s should work on characters, not bytes\n";
+
+    my $s = "\x{e4}\x{100}";
+
+    # This is not expected to match: the point is that
+    # neither should we get "Malformed UTF-8" warnings.
+    print $s =~ /\G(.+?)\n/gcs ?
+       "not ok 844\n" : "ok 844\n";
+
+    my @c;
+
+    while ($s =~ /\G(.)/gs) {
+       push @c, $1;
+    }
+
+    print join("", @c) eq $s ? "ok 845\n" : "not ok 845\n";
+}
End of Patch.

Reply via email to