Re: Converting codepages to UTF8
- From: Donald King <dlking@xxxxxxxx>
- Date: Thu, 30 Mar 2006 12:22:48 -0600
P wrote:
Hello,
Is there a Perl module which implements converting of codepages
(such as you get when running "chcp" in a command prompt) to UTF8?
Something that allows me to specify, for example, codepage 437 and
then converting it to UTF8. I've looked through the documentation for
the module Encode, but it doesn't seem to deal with codepages at all.
Thank you for any information you can provide that will nudge me in
the
right direction.
Best regards,
Angela Druss
The Encode module should do what you want. As far as I know, Encode supports all the codepages out there. Assuming that $filename has raw octets in the native codepage, something like:
$unicodefn = decode("cp437", $filename);
.... should do the trick. The resulting string will be in Perl's Unicode format -- keep in mind that while Perl uses UTF-8 internally, Perl treats Unicode strings differently from strings of raw UTF-8 octets.
--
Donald King, a.k.a. Chronos Tachyon
http://chronos-tachyon.net/
.
- References:
- Converting codepages to UTF8
- From: P
- Converting codepages to UTF8
- Prev by Date: Re: perl deparse question.
- Next by Date: URI (was: Re: Arbitrarily Many Nested Loops)
- Previous by thread: Re: Converting codepages to UTF8
- Next by thread: perl deparse question.
- Index(es):
Relevant Pages
|