Perl 6 and print columns

Does Perl 6 have something equivalent to the Unicode :: GCString columns method?

Example for Perl 5:

 #!/usr/bin/env perl use warnings; use strict; use 5.10.0; use utf8; use open qw( :std :utf8 ); use Unicode::GCString; my $s = '合'; # U+5408 say length $s; # 1 my $gcs = Unicode::GCString->new( $s ); say $gcs->columns; # 2 
+7
perl perl6
source share
1 answer

Perl6 has built-in Unicode support with normal Uni and NFC / NFD / NFKC / NFKD standards.

I vaguely understand that the Unicode :: GCString :: columns method defines support based on the East Asian language. 合 consists of 2 "syllables" (they call it "grapheme clusters") one above the other, thus 2 columns.

At the same time, perl6 inside (at the MoarVM level) has access to the unicode database where the linebreaking properties are stored, but as far as I know, there is currently no module, such as Unicode :: UCD, available to create East_Asian_Width properties for something like Unicode :: GCString.

Converting Unicode :: LineBreak to perl6, on the other hand, looks simple enough, accessing the sombok library through NativeCall.

+4
source share

All Articles