Re: decode a string to "Perl's internal form" without Encode module?
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxx
- Date: 28 Feb 2007 08:17:23 GMT
Raymundo <gypark@xxxxxxxxx> wrote in comp.lang.perl.misc:
Hello,
At first, I'm sorry that I'm not good at English. :-)
There is a string which is encoded with UTF-8, EUC-KR(Korean), EUC-JP,
or any other encoding scheme.
I want to decode it so that it become a string in "Perl's internal
form" (that is, unicode form.. is it so called "utf8"?).
For example,
$octets = "°¡³ª"; # 2 Korean characters, sequence of 6 Bytes
according to UTF-8
$string = "\x{AC00}\x{B098}"; # 2 Unicode characters. I want to get
this from $octets
It can be done easily using Encode module:
use Encode qw(decode);
$string = decode("UTF-8", $octets);
My question is, if I don't have Encode module in my server and I have
You have the Encode module, it is part of every complete Perl
installation.
Text::Iconv module instead, Can I do the same thing using it? If I
can, how?
I don't know the Text::Iconv module, so I can't answer that. If Encode
works for you, use that.
Anno
.
- Follow-Ups:
- Re: decode a string to "Perl's internal form" without Encode module?
- From: Ben Morrow
- Re: decode a string to "Perl's internal form" without Encode module?
- References:
- Prev by Date: FAQ 6.7 How can I match a locale-smart version of "/[a-zA-Z]/"?
- Next by Date: Re: using a list
- Previous by thread: decode a string to "Perl's internal form" without Encode module?
- Next by thread: Re: decode a string to "Perl's internal form" without Encode module?
- Index(es):
Relevant Pages
|