On Wednesday 16 Dec 2009 13:49:19 Xiao Lan (小兰) wrote:
> Hello,
> 
> What's the standard way to encode a whole document to utf8 (or other
> encoding mode)?
> 
> For example, I want to encode a document which is gb2312 encoded
> originally to utf8, I could do:
> 
> perl -MEncode -ne 'print encode("utf8",decode("gb2312",$_))' 1.txt > 2.txt
> 
> (here 1.txt is the gb2312 one, 2.txt is utf8 one.)
> 

This is fine.

> But is there a better or more standard way to do it?
> 

Not in Perl. The Encode module also gives you a "from_to" wrapper, but what 
you've done would be equivalent to using it.

> Thanks for this and for all the before of your helps.
> 
> // Xiao-Lan
> 

Regards,

        Shlomi Fish


-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

Bzr is slower than Subversion in combination with Sourceforge. 
( By: http://dazjorz.com/ )

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to