From: Gurusamy Sarathy Date: Wed, 24 Mar 1999 02:26:38 +0000 (+0000) Subject: fix off-by-one that resulted in misparse of C X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f96ec2a286b2f6894935f96d87679d41cc20f6f6;p=p5sagit%2Fp5-mst-13.2.git fix off-by-one that resulted in misparse of C p4raw-id: //depot/perl@3136 --- diff --git a/regcomp.c b/regcomp.c index a325b42..bacf2ca 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2498,7 +2498,7 @@ regclassutf8(void) e = strchr(PL_regcomp_parse++, '}'); if (!e) FAIL("Missing right brace on \\x{}"); - value = scan_hex(PL_regcomp_parse + 1, e - PL_regcomp_parse, &numlen); + value = scan_hex(PL_regcomp_parse, e - PL_regcomp_parse, &numlen); PL_regcomp_parse = e + 1; } else { diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t new file mode 100755 index 0000000..e5b3bb5 --- /dev/null +++ b/t/pragma/utf8.t @@ -0,0 +1,37 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + unshift @INC, '../lib'; + $ENV{PERL5LIB} = '../lib'; +} + +print "1..3\n"; + +my $test = 1; + +sub ok { + my ($got,$expect) = @_; + print "# expected [$expect], got [$got]\nnot " if $got ne $expect; + print "ok $test\n"; +} + +{ + use utf8; + $_ = ">\x{263A}<"; + s/([\x{80}-\x{10ffff}])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; + + $_ = ">\x{263A}<"; + my $rx = "\x{80}-\x{10ffff}"; + s/([$rx])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; + + $_ = ">\x{263A}<"; + my $rx = "\\x{80}-\\x{10ffff}"; + s/([$rx])/"&#".ord($1).";"/eg; + ok $_, '>☺<'; + $test++; +}