> What you got from <$sample_file_fh> is maybe different encoding chunk, for
> example,iso-8859-1,gb2312 or UTF-8 etc.
> You want to translate them to Perl's internal utf8 format firstly,which
> includes a utf8 flag and the data part.After translation,utf8 flag should be
> on and the data part is the chunk with utf8 encoding.You do it with the
> decode() function from Encode module:
>
> my $internal_utf8 = decode("gb2312",$_); # given the data was gb2312
> encoding originally
>
>


And what if I don't know the encoding type of the input chunk.  Can't we use
'decode' function in generalized way. Something like this:

my $internal_utf8 = decode($_);

i.e Decoding it to internal UTF8 irrespective of the input encoding type.

Cheers,
Parag

Reply via email to