Why does this print a U and not a Ü?
#!/usr/bin/env perl
use warnings;
use 5.014;
use utf8;
binmode STDOUT, ':utf8';
use charnames qw(:full);
my $string = "\N{LATIN CAPITAL LETTER U}\N{COMBINING DIAERESIS}";
while ( $string =~ /(\X)/g ) {
say $1;
}
# Output: U
Your code is correct.
You really do need to play these things by the numbers; don’t trust what a “terminal” displays. Pipe it through the uniquote program, probably with
-xor-v, and see what it is really doing.Eyes deceive, and programs are even worse. Your terminal program is buggy, so is lying to you. Normalization shouldn’t matter.