> From:  Martin Jespersen <[EMAIL PROTECTED]>
> Date:  Fri, 13 Oct 2000 00:00:41 +0200
>
> Hi all
> 
> i have written an sms forward filter in perl that allows me to trigger an s
> ms message to me if a
> mail matches my criteria.
> 
> i then send an sms including the sender of the mail and the subject line.
> 
> Now my problem is this:
> 
> I live in denmark and thus it happens pretty often that a subject line incl
> udes non-standard ascii
> characters.
> 
> subject lines with non-standard ascci characters are iso-8859-1 encoded, ex
> ample follows:
> 
> =?iso-8859-1?Q?N=E5_min_skat_-_jeg_g=E5r_til_afdelingsm=F8de_i?= 
> =?iso-8859-1?Q?_Bredgade_nu_-_jeg_ringer_senere=2E_Kys_til_dig_fra_mig?= 
> =?iso-8859-1?Q?_=2AS=2A?=
> 
> this subject actually reads:
> 
> N� min skat - jeg g�r til afdelingsm�de iBredgade nu - jeg ringer senere. Kys 
> til dig fra mig*S*
> 
> (if this looks weird don't worry -it's danish :)
> 
> ofcourse this looks pretty silly in an sms message s� what i would like is a
>  way to convert this
> back to ascii

I assume you mean you want to convert it back to iso-58859-1.

I did this in tcl a while back.  It's actually fairly simple, ?charset?Q?text? 
means that 'text' is encoded into ascii using quoted printable.  quoted 
printable basically just says that '=dd' should be replaced with the code in 
hex.

I think the actual conversion is a one liner in perl...something along the 
lines of 's/=(..)/chr(hex($1))/eg'  (Note this is untested.)

Chris

-- 
Chris Garrigues                 http://www.DeepEddy.Com/~cwg/
virCIO                          http://www.virCIO.Com
4314 Avenue C                   
Austin, TX  78751-3709          +1 512 374 0500

  My email address is an experiment in SPAM elimination.  For an
  explanation of what we're doing, see http://www.DeepEddy.Com/tms.html 

    Nobody ever got fired for buying Microsoft,
      but they could get fired for relying on Microsoft.


PGP signature

Reply via email to