[ic] MIME::Lite error with UTF-8 enabled

Gert van der Spoel gert at 3edge.com
Thu Mar 5 14:16:29 UTC 2009


> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-
> users-bounces at icdevgroup.org] On Behalf Of Stefan Hornburg
> Sent: Thursday, March 05, 2009 1:58 PM
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] MIME::Lite error with UTF-8 enabled
> 
> Gert van der Spoel wrote:
> >> -----Original Message-----
> >> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-
> >> users-bounces at icdevgroup.org] On Behalf Of Stefan Hornburg
> >> Sent: Thursday, March 05, 2009 1:40 PM
> >> To: interchange-users at icdevgroup.org
> >> Subject: [ic] MIME::Lite error with UTF-8 enabled
> >>
> >> Hello,
> >>
> >> one of my catalogs is running current Interchange from CVS and UTF-8
> >> enabled
> >> as follows:
> >>
> >> Variable MV_UTF8 1
> >> Variable MV_HTTP_CHARSET utf-8
> >>
> >> AllowGlobal fshop
> >> PerlAlwaysGlobal fshop
> >>
> >> Sometimes the mail compostion with MIME::Lite bails out as follows:
> >>
> >> /cgi-bin/f-shop/checkout Runtime error: Wide character in subroutine
> >> entry at /home/interchange/perl/lib/site_perl/5.10.0/MIME/Lite.pm
> line
> >> 2259.
> >>
> >>   /^QUOTED-PRINTABLE$/ and do {
> >>                 ### UNTAINT since m//mg on tainted data loops
> forever:
> >>                 my ($untainted) = ( $self->{Data} =~ m/\A(.*)\Z/s );
> >>
> >>                 ### Encode it line by line:
> >>                 while ( $untainted =~ m{^(.*[\r\n]*)}smg ) {
> >>                     ### have to do it line by line...
> >>                     my $line = $1; # copy to avoid weird bug; rt
> 39334
> >> 2259>>              $out->print( encode_qp($line) );
> >>                 }
> >>                 last DATA;
> >>
> >> Any ideas what might causing this problem?
> >
> > Is it perhaps with orders that have some data containing accented
> characters
> > such as ü  ?
> 
> Accented characters as such are working fine with MIME::Lite.
> 
> But it looks like really screwed up text (result of former experiments
> with escaping UTF8 - no good) is causing this.
> 
> ulisses=> select city from addresses where uid = 28335 and archived is
> FALSE;
>                city
> ----------------------------------
>  Waldems Wüstems
>  Waldems WÃÆÃâÃâ ââ¬â¢ÃÆââ¬Å¡Ãâüstems
> (2 rows)
> 
> Still it shouldn't bail out.

Did you try to change the strings (if you are certain it is the 'city' that
does it) to see which character(s) are the direct cause of this?  

http://perldoc.perl.org/MIME/QuotedPrint.html

By switching on the UTF8 flags I assume that data is being passed around as
UTF8 ... 
Aparently you are not supposed to pass that on directly to encode_qp like
that:

"Perl v5.8 and better allow extended Unicode characters in strings. Such
strings cannot be encoded directly, as the quoted-printable encoding is only
defined for single-byte characters. The solution is to use the Encode module
to select the byte encoding you want. For example:

    use MIME::QuotedPrint qw(encode_qp);
    use Encode qw(encode);

    $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));
    print $encoded;
"
Not sure if this helps ... 

CU,

Gert









More information about the interchange-users mailing list