develooper Front page | perl.unicode | Postings from March 2007

Encode fallback for iso-2022-jp

From:
Tatsuhiko Miyagawa
Date:
March 27, 2007 18:05
Subject:
Encode fallback for iso-2022-jp
Message ID:
693254b90703271805g408b2d8dp2b29d0a4edc51267@mail.gmail.com
Hi,

I'm writing a module to see if the given string can be encoded using
the given encoding, to find the minimal encoding to use in outgoing
emails. To do that I call encode() function with FB_CROAK fallback to
see if the encode() function dies.

This approach works realy well, except that I'm having problems with
"iso-2022-jp", because Encode::JP::JIS7 goes:

    my $octet = Encode::encode( 'euc-jp', $utf8, FB_PERLQQ );

and encode all non-jis characters into PERLQQ \x{XXXX} form and
ignores the CHECK flag. Seems to me this is a bug.

-   my $octet = Encode::encode( 'euc-jp', $utf8, FB_PERLQQ );
+   my $octet = Encode::encode( 'euc-jp', $utf8, $chk );

Hope this patch applied. Thanks,

-- 
Tatsuhiko Miyagawa



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About