This is the best I could come up with from the documents - maybe a simpler way, but I'm not sure.
my $in = "Él está un pingüino"; my $stripped = Uni.new($in.NFD.grep: { !uniprop($_, 'Grapheme_Extend') }).Str; say $stripped;
The .NFD method converts the string to a normalization form D (expanded), which separates graphemes from the base code points and combines code points when possible. Then grep returns a list of only those code points that do not have the "Grapheme_Extend" property, i.e. Removes combined code points. Uni.new(...).Str then collects these code points back into a string.
You can also combine these pieces to answer the second question; eg:.
$in.NFD.map: { Uni.new($_).Str }
will return a list of 1-character strings, each with one expanded code number, or
$in.NFD.map(&uniname).join("\n")
will make a nice little unicode debugger.
hobbs source share