Encode fallback for iso-2022-jp

[email protected] ("Tatsuhiko Miyagawa") Tue, 27 Mar 2007 18:05:44 -0700
Newsgroups perl.unicode
Message-ID <[email protected]>
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