Re: decode a string to "Perl's internal form" without Encode module?
- From: "Raymundo" <gypark@xxxxxxxxx>
- Date: 28 Feb 2007 09:08:01 -0800
Hmm... I have seen a web-hosting server in which Perl 5.6 was
installed and there wasn't Encode module. :-D
Anyway, thanks to your advices.
Raymundo at South Korea
On 2월28일, 오후7시34분, Ben Morrow <b...@xxxxxxxxxxxxx> wrote:
Quoth anno4...@xxxxxxxxxxxxxxxxxxxxxx:
Raymundo <gyp...@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.
...from 5.8 onwards. If you are stuck with 5.6, you should be aware that
that version of Perl did not handle Unicode at all internally, and you
really ought to upgrade.
Ben
.
- Follow-Ups:
- References:
- Prev by Date: Re: change chr(9) ?
- Next by Date: Rindex used to find end of a string
- Previous by thread: Re: 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
|