For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2005 > "=20"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "=20"
Tom Allison

2005-07-25, 10:03 pm

I find these a lot on email and I know it's some encoding problem somewhere.

How are you supposed to handle this so things come out clean?
besides doing this:
$message =~ s/=20//sg
(or was it 'm', I'll have to look it up)
Jeff 'japhy' Pinyan

2005-07-25, 10:03 pm

On Jul 25, Tom Allison said:

> I find these a lot on email and I know it's some encoding problem somewhere.
>
> How are you supposed to handle this so things come out clean?
> besides doing this:
> $message =~ s/=20//sg
> (or was it 'm', I'll have to look it up)


Well, the /m and /s modifiers are useless there (since there's no '.' or
'^' or '$' in the regex). But =20 is like %20 in a URL -- it represents a
space. As far as I can remember, it's another form of encoding
characters. You'd decode it in the same way:

$str =~ s/=([a-fA-F0-9]{2})/chr hex $1/eg;

--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
Thomas Bätzler

2005-07-26, 4:05 am

Tom Allison <tallison@tacocat.net> wrote:
> I find these a lot on email and I know it's some encoding
> problem somewhere.


That's the quoted-printable encoding for MIME mails.

Of course you can handle it manually like japhy suggested,
but the proper way would be to use MIME::Parser to handle
all the different encodings.

HTH,
Thomas
Tom Allison

2005-07-26, 9:00 am

Thomas Bätzler wrote:
> Tom Allison <tallison@tacocat.net> wrote:
>
>
>
> That's the quoted-printable encoding for MIME mails.
>
> Of course you can handle it manually like japhy suggested,
> but the proper way would be to use MIME::Parser to handle
> all the different encodings.
>
> HTH,
> Thomas
>


That's discouraging.
This is the output from Email::MIME objects....

I'll have to check but this might be another bug report.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com