I understand a bit about how encoded email data works, but I'm far from an expert. I'm stumped on a problem that just started occurring for one of our customers. My script isn't able to parse quoted-printable, euc-jp mail subjects. It does fine with other asian charsets + quoted-printable, and also with euc-jp base64 data.
The data that I have is a little fishy looking to me, and I'm wondering if someone can offer any insight into what's different between my working and non-working strings below, and/or advice on how to decode the non-working string.
use strict; use warnings; use Encode; for my $subject ( # bad: '=?euc-jp?Q?=83v=83=8D=83t=83B=81=5B=83=8B?=', # bad: '=?euc-jp?Q?=97L=97=BF=83T=81=5B=83r=83X?=', # good: '=?euc-jp?Q?=B2=F1=B0=F7=CD=CD=A4=D8=C9=AC=A4=BA=C5=F +6=A4=EB?=', ) { print "\ndecoding $subject ...\n"; my $decoded = Encode::decode('MIME-Header',$subject); print "result: $decoded\n"; } __END__ decoding =?euc-jp?Q?=83v=83=8D=83t=83B=81=5B=83=8B?= ... result: \x83v\x83\x8D\x83t\x83B\x81[\x83\x8B decoding =?euc-jp?Q?=97L=97=BF=83T=81=5B=83r=83X?= ... result: \x97L\x97\xBF\x83T\x81[\x83r\x83X decoding =?euc-jp?Q?=B2=F1=B0=F7=CD=CD=A4=D8=C9=AC=A4=BA=C5=F6=A4=EB?= + ... Wide character in print at ./test line 15. result: [something that looks like "correct" garbled text in my shell +]
The thing that looks strange about the bad strings is the alternation of "=xx" with single ascii characters. I think technically that's valid quoted-printable, but usually I just see the repeated "equals sign plus 2 hex chars" like in the good string above.
Also, when I bounce this mail to my outlook, it shows the subject correctly.
Any advice?
Thanks,
Joe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |