This hack sort of shows what is going on ...
I tried it on a Windows 10 "DOS" prompt session
Code:
--------------------
#!/usr/bin/perl
use warnings;
use strict;
use Encode qw(encode decode decode_utf8);
my $in_enc = 'utf-8';
my $out_enc = 'cp850';
my $testoctets = pack("C*", 0xC3, 0x84); # Upper-case A-umlaut as UTF-8
Store this script as ANSI/ASCII to show that it does not rely on being UTF-8
file
# text strings::
my $text_str = decode($in_enc, $testoctets);
print "Decoded by decode:$text_str:\n";
$text_str = decode_utf8($testoctets);
print "Decoded by decode_utf8:$text_str:\n";
$text_str = lc $text_str;
print "lc of string:$text_str:\n";
print encode($out_enc, $text_str); # should print 'รค', if lc worked as
expected
--------------------
>From Windows command line prompt ...
chcp
you will see the current code page - was cp850 on mine
which matches the out_enc above ... and the script works (in that the
final print out is lowercase a-umlaut
then type
cpcp 65001
run script again and it does not appear to work (because it is producing
the output in a character set not handled by the terminal session)
and change $out_enc to utf-8 and rerun the script then it should display
the lower case a-umlaut
Paul Webster
http://dabdig.blogspot.com
------------------------------------------------------------------------
Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=106900
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins