[PerlChina] about unicode

黄叶 hylinux at gmail.com
Mon Dec 12 21:44:30 PST 2005


in addition, how use the function named "binmode "?
Can i get a complete code?
here is i write , but it is not work.

#!/usr/bin/perl -w
use strict;
use IO::File;
use Encode qw(encode decode from_to);

my $file = IO::File->new("./report.csv", "r") or die " $!";
my $file_temp = IO::File->new("./li.txt", "w") or die "$!";

my $i = 1;
my $a = "\"2005-8\"";
if ( $a =~ /^"/ ) {
print "OK", "\n", $a, "\n";;
}

while ( $b = <$file> ) {
        from_to($b, "UTF-16LE", "Latin1");
#       my $b = decode("UTF-16LE", $_);
        print $b, "\n";
        print $file_temp $b, "\n";
$i++;
}

$file->close();
print $i, "\n";
-------------- next part --------------
q?????!???,r??m??m???????j+??j)r?j??j?r????9?w???!??M5??
-------------- next part --------------
z'???r?????????z????\??^??j?j??y???,????
??Z???i?^R?a???f????????????z{l?m4??????+?M4??


More information about the China-pm mailing list