THANK YOU!! That cleared up a lot. I didn't even suspect that the culprit was sqlite.
I still have trouble reading UTF-8 from command line arguments. I assume this is not a Perl issue; any suggestions how to fix?
#!/usr/bin/env perl
use v5.40;
use utf8;
use open qw(:std :encoding(UTF-8));
my $utf8_text1 = shift;
say "A variable set from argument on command line";
show ($utf8_text1);
my $utf8_text2 = 'Åke Lindström;
say "A variable set to UTF8 literal";
show($utf8_text2);
chomp (my $utf8_text3 = <>);
say "A variable set by reading from STDIN";
show($utf8_text3);
sub show($str) {
say "Binary: ", join ' ', (unpack "H*", $str) =~ m/../g ;
say "Text>STDOUT: $str";
}
Output:
$ echo "Åke Lindström" | u 'Åke Lindström'
A variable set from argument on command line
Binary: c3 85 6b 65 20 4c 69 6e 64 73 74 72 c3 b6 6d
Text>STDOUT: Ã
ke Lindström
A variable set to UTF8 literal
Binary: c5 6b 65 20 4c 69 6e 64 73 74 72 f6 6d
Text>STDOUT: Åke Lindström
A variable set by reading from STDIN
Binary: c5 6b 65 20 4c 69 6e 64 73 74 72 f6 6d
Text>STDOUT: Åke Lindström