Created
March 19, 2019 02:57
-
-
Save dmaestro/041b7f23835e403f3044666535c52c36 to your computer and use it in GitHub Desktop.
Example of processing codepoint sequences in Perl 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doug$ cat z2.pl6 | |
use v6; | |
my $s = "Zoé"; | |
.chr.print for |$s.NFC, 10; | |
.chr.print for |$s.NFD, 10; | |
doug$ perl6 z2.pl6 | |
Zoé | |
Zoé | |
perl6 z2.pl6 | perl6 -e '$*IN.encoding(<utf8>); my $z1 = $*IN.get; my $z2 = $*IN.get; say $z1 eq $z2' | |
True | |
perl6 z2.pl6 | perl6 -e '$*IN.encoding(<utf8-c8>); my $z1 = $*IN.get; my $z2 = $*IN.get; say $z1 eq $z2' | |
False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Paul Bennett on Facebook was asking about comparing two differently encoded Unicode strings in Perl 6.