perl-unicode

Encode fallback for iso-2022-jp

2007-03-27 18:05:55
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

<Prev in Thread] Current Thread [Next in Thread>
  • Encode fallback for iso-2022-jp, Tatsuhiko Miyagawa <=