(keitai-l) Re: Fun with Base64 Decoding

From: Brock, Gavin [IT] <gavin.brock_at_nssmb.com>
Date: 10/25/01
Message-ID: <4F7632AA5501D411A7100008C791F4E203890419@exchjp08.nssmb.com>
Nearly, you need to remove the 'padding' (as the error said)...

my $line = '=?ISO-2022-JP?B?GyRCRnxLXDhsGyhC?=';
my $head = quotemeta('=?ISO-2022-JP?B?'); # Save working this out by hand!!
$line =~ s/^$pat//; # Trim header
print decode_base64($line);

Works for me!! 

Maybe this should be patched into Jcode.pm. I'll try if I have time.

Cheers,

Gavin

-----Original Message-----
From: Renfield Kuroda [mailto:Renfield.Kuroda@morganstanley.com]
Sent: Thursday, October 25, 2001 5:19 PM
To: keitai-l@appelsiini.net
Subject: (keitai-l) Re: Fun with Base64 Decoding


With  =?ISO-2022-JP?B?GyRCRnxLXDhsGyhC?= you should be able to decode as you
mentioned.

Can you expand on what "gibberish" means? It'll probably look like gibberish
as
it's jis-encoded Japanese.

r e n

Ron Schei wrote:

> Hello,
>
> Tech question
> I've written a perl script to manipulate pop mail from a keitai, but I'm
> having trouble with Japanese subject lines.
> Using Perl with the MIME::Base64 module, I'm trying to turn this:
> =?ISO-2022-JP?B?GyRCRnxLXDhsGyhC?=
> back into the original
> 日本語
>
> Here's what I know doesn't work....
>
> use MIME::Base64;
>
> ### ... detect a Base64 encoded line .. ###
> ###   strip control characters, leaving this: GyRCRnxLXDhsGyhC ###
>
> $newline = decode_base64($line);
>
> at which point $newline is gibberish.
> I've tried jcode::converting it every-which-way, but nothing seems to
work.
> The base64 encoding of 日本語 (EUC) seems to be
> xvzL3Ljs
> which decodes just fine.
> Any ideas on how to turn a Base64 encoded ISO-2022-JP string back into
> readable S-JIS would be most appreciated!
> Thanks,
> Ron
>
> [ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]

--
ascii: r e n f i e l d
octal: ¥162 ¥145 ¥156 ¥146 ¥151 ¥145 ¥154 ¥144
hex: ¥x72 ¥x65 ¥x6e ¥x66 ¥x69 ¥x65 ¥x6c  ¥x64

e-business technologies | engineering and strategy

"Connecting people, ideas and capital,
we will be the world's first choice
for achieving financial aspirations"



[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]



[ Need archives? How to unsubscribe? http://www.appelsiini.net/keitai-l/ ]
Received on Thu Oct 25 11:42:22 2001