R
Raymundo
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
Text::Iconv module instead, Can I do the same thing using it? If I
can, how?
use Text::Iconv;
$converter = Text::Iconv->new("UTF-8", to-ENCODING);
$string = $converter->convert($octets);
What do I have to write for "to-ENCODING"?
I tried to "UNICODE" but Text::Iconv seemed to regard "UNICODE" as
"UCS-2LE"...
Any advice would be appreciated,
Raymundo at South Korea.
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
Text::Iconv module instead, Can I do the same thing using it? If I
can, how?
use Text::Iconv;
$converter = Text::Iconv->new("UTF-8", to-ENCODING);
$string = $converter->convert($octets);
What do I have to write for "to-ENCODING"?
I tried to "UNICODE" but Text::Iconv seemed to regard "UNICODE" as
"UCS-2LE"...
Any advice would be appreciated,
Raymundo at South Korea.