[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] bug in MIME::QuotedPrint ?



At 12:11 AM +0100 2/2/00, Axel Rose wrote:
>I think the Perl module MIME::QuotedPrint gives wrong results
>under MacPerl. I tested the following with QuotedPrint.pm from
>standard installation and from cpan-mac.
>
>#!perl -w
>
>use MIME::QuotedPrint;
>
>$string = "ä";
>$estring = encode_qp( $string );
>print "encode_qp( $string ) = $estring\n";
>
>__END__
>
>Result is
>encode_qp( ä ) = =8A
>
>Running under Linux I get the proper result
>encode_qp( ä ) = =E4

Running on a Sun Ultra 5 running Solaris 7:

leprss% perl !$
perl test_encode.pl
encode_qp( ä ) = =8A

Running on Yellow Dog Linux:

linux% perl test_encode.pl
encode_qp( ä ) = =8A

I suspect you transferred the file in such a way as to change the 
encoding of ä.  (Did you email it to yourself?).  The character code 
that stands for ä is likely to be different on Linux than on MacOS. 
I simply pasted your script into a terminal window, so no translation 
was done, and it still looks like an ä to me on my iBook.  I suspect 
it will look like something else tomorrow when I'm at the Sun's 
console.

>
>
>Looking into the source code I find
>...
>$res =~ s/([^ \t\n!-<>-~])/sprintf("=%02X", ord($1))/eg;  # rule #2,#3
>$res =~ s/([ \t]+)$/
>	join('', map { sprintf("=%02X", ord($_)) }
>		split('', $1)
>       )/egm;                        # rule #3 (encode whitespace at eol)
>...
>
>Not understanding this fully I suspect the ord() function.
>
>Can anybody confirm this?
>Any ideas for a workaround?
>
>
>Regards
>
>
>Axel
>----------------------------------------------------------------------
>Axel Rose, Springer & Jacoby Digital GmbH & Co. KG, mailto:rose@sj.com
>   pub PGP key 1024/A21CB825 E0E4 BC69 E001 96E9  2EFD 86CA 9CA1 AAC5
>   "... denn alles, was entsteht, ist wert, daß es zugrunde geht ..."
>

--
Paul Schinder
schinder@pobox.com

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org