At 6:19 pm +0100 25/2/04, Sebastian Lehmann wrote:
Can anybody tell me how to work with UTF8 and UTF16 in the same script? Any help would be greatly appreciated.
Suppose that /tmp/iba.txt contains the text "ibaņez" in UCS-2, preceded by the BOM, then this works here (Perl 5.8.3)
use Encode qw/encode decode/; my $f_16 = qq~/tmp/iba.txt~; open F16, qq~$f_16~; my $ucs2 = <F16> ; my $utf8 = decode("UCS-2BE", $ucs2) ; print uc $utf8 ;
Does that help?
JD