Re: decode a string to "Perl's internal form" without Encode module?



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

.



Relevant Pages

  • RE: Trying to make DBI work for me
    ... leaving something behind that conflicts with the new installation. ... Everything worked fine if we unstalled perl 5.6, ... directory, installed perl 5.8, and reloaded the DBI and DBD modules. ... Using 'ppm uninstall DBI' I uninstalled DBI. ...
    (perl.dbi.users)
  • RE: rooted NT/2K boxen?
    ... If you suspect that a compromise has occurred, ... above information are available as Perl scripts from ... executables (Perl installation not required), ... Health - your guide to health and wellness ...
    (Focus-Microsoft)
  • Re: question about installation of GD::Text on cygwin (could be a Makefile q)
    ... I just created a fresh installation of Perl 5,8.2 on my platform: ... Writing Foo/Makefile.PL ... If someone else could run the above tests on Cygwin as well, ...
    (comp.lang.perl.misc)
  • Re: pkgdb -F and a few other questions
    ... Some of the app's were dependent on Perl 5.6.1, ... > to the Perl 5.8.1 and all is well, and ran a use.perl port command. ... Yes -- replacing the main perl installation does tend to blow away ... All of the packages in question are modules you've installed directly ...
    (freebsd-questions)
  • Re: Debian Linux Perl installation (testing dist)
    ... debuian user or there might be a debian perl mailing list even. ... > This can lead to installation bugs (as I've posted in another clpm ... the package system is aware what package owns what file, ...
    (comp.lang.perl.misc)