Returns of Encode::decode / guess_encoding ?

Returns of Encode::decode / guess_encoding ?

am 02.10.2007 16:02:35 von pkaluski

Hello,

Does anyone know what's the return of Encode::decode(), guess_encoding(), and Encode::Guess->guess() ?

Like $my_guess = guess_encoding($mystring, qw/big5/);
die $my_guess unless ref($my_guess);

Then it prints out "big5-eten or cp936 at c:\myproject\....."

I want to catch this "big5-eten" and "cp936" word. So that I can use it to {try to} decode with it...

How Can I do that? Thanks


Thanks for everyone's help :)

Re: Returns of Encode::decode / guess_encoding ?

am 02.10.2007 17:52:12 von paduille.4061.mumia.w+nospam

On 10/02/2007 09:02 AM, 地球人 wrote:
> Hello,
>
> Does anyone know what's the return of Encode::decode(), guess_encoding(), and Encode::Guess->guess() ?
>
> Like $my_guess = guess_encoding($mystring, qw/big5/);
> die $my_guess unless ref($my_guess);
>
> Then it prints out "big5-eten or cp936 at c:\myproject\....."
>
> I want to catch this "big5-eten" and "cp936" word. So that I can use it to {try to} decode with it...
>
> How Can I do that? Thanks
>
>
> Thanks for everyone's help :)
>

According to the documentation for Encode::Guess,
Encode::decode("Guess",...) returns an anonymous subroutine if it
succeeds, and it returns a string error message if it fails.

The same is true of guess_encoding and Encode::Guess->guess.