Is it possible to programmatically display all the "paired" characters?
eg. when I received, for example, a character <
, how to find the corresponding pair " >
"?
The following code snippet prints each mirrored ascii character.
use 5.018;
use warnings;
use charnames qw(:full);
for my $n (0..127) {
my $c = chr $n;
printf "%02x: [%s] - %s\n", $n, $c, charnames::viacode($n) if $c =~ /\p{Bidi_Mirrored=Y}/;
}
prints:
28: [(] - LEFT PARENTHESIS
29: [)] - RIGHT PARENTHESIS
3c: [<] - LESS-THAN SIGN
3e: [>] - GREATER-THAN SIGN
5b: [[] - LEFT SQUARE BRACKET
5d: []] - RIGHT SQUARE BRACKET
7b: [{] - LEFT CURLY BRACKET
7d: [}] - RIGHT CURLY BRACKET
But the AFAIK property Bidi_Mirrored
does not match the "paired" one, for example. left-right pairs, because, for example, the next char has a property Bidi_Mirrored
, but it probably does not have any “pair”.
∰ U+02230 VOLUME INTEGRAL
And if this property is Bidi_Mirrored
correct for "paired" characters, the question remains the same: how to find the code point of a "pair"? (or name)?
In short: want to print all unicode "paired" characters, for example. pairs like:
« U+000AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
» U+000BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
or
≤ U+02264 LESS-THAN OR EQUAL TO
≥ U+02265 GREATER-THAN OR EQUAL TO
....
, :
:
, , , Bidi_Mirroring_Glyph
aka (bmg)
Bidi_Paired_Bracket
aka (bpb)
perl. AFAIK Unicode::UCD - , , , .
, 5.024
Unicode 8.0?:):)