Commit 6ccbaca3 authored by Jason Rhinelander's avatar Jason Rhinelander
Browse files

[[:xdigit:]] doesn't work properly under 'i' in a regex (perlbug #64838);...

[[:xdigit:]] doesn't work properly under 'i' in a regex (perlbug #64838); changed to 0-9a-fA-F which does work.
parent 42e0681d
......@@ -24,11 +24,11 @@ utf8::is_utf8($_) or utf8::decode($_) or die "Invalid input (not UTF-8): $_\n" f
my $arg = qr{
(
(?:0?x | U\+?)? [[:xdigit:]]+ (?:[_ ][[:xdigit:]]+)* # Hex, such as: 0x203d, x203d, 0x20_3d, etc. single _'s or spaces [which need to be shell escaped] allowed. Also allows the U+0123 system.
(?:0?x | U\+?)? [0-9a-fA-F]+ (?:[_ ][0-9a-fA-F]+)* # Hex, such as: 0x203d, x203d, 0x20_3d, etc. single _'s or spaces [which need to be shell escaped] allowed. Also allows the U+0123 system.
)
|
(
(?:utf)?8\+? [[:xdigit:]]+ (?:[_ ][[:xdigit:]]+)* # Hex such as UTF8+E2_80_BD or 8+42, representing a UTF8 representation
(?:utf)?8\+? [0-9a-fA-F]+ (?:[_ ][0-9a-fA-F]+)* # Hex such as UTF8+E2_80_BD or 8+42, representing a UTF8 representation
)
|
(
......@@ -262,7 +262,7 @@ sub codepoint {
if (defined $utf8_code) {
$utf8_code =~ s/.*\+//;
(my $c = $utf8_code) =~ y/ _//d;
my $bytes = join '', map bytes::chr(hex $_), split /(?=(?:[[:xdigit:]]{2})+$)/, $c;
my $bytes = join '', map bytes::chr(hex $_), split /(?=(?:[0-9a-fA-F]{2})+$)/, $c;
utf8::decode($bytes) or die "Invalid input: 'UTF8+$utf8_code' does not appear to be a valid UTF-8 sequence\n";
length($bytes) == 1 or die "Invalid input: 'UTF8+$utf8_code' decodes to multiple characters\n";
return ord $bytes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment