|Think about Loose Coupling|
Transcoding MIME Stringsby PoorLuzer (Beadle)
|on Oct 09, 2009 at 18:08 UTC||Need Help??|
PoorLuzer has asked for the
wisdom of the Perl Monks concerning the following question:
I have been handling some email related process recently, mainly with processing information from the raw mail headers.
What I want to understand are: 1. how to map strings like these:
I get the same, unhelpful (does not help me get the desired mappings above), results regardless of whether I use:
or I use:
For some reason that I am unable to understand, the following fails completely (the output shows me the unknown character designator '_' for any character!):
Here is some code:
For this example, consider the date string:
Sat, 9 Feb 2008 17:04:08 -0380
The timezone in the string is clearly bogus (minutes value > 60); yet this happens in "real life".
As evident from the code, I don't need the timezone information anyways. So how do I "lop it off" (is it recommended?) reliably?
I would rather have someone tell me a magic flag that I am unaware of that makes the UnixDate ignore the timezone as "chopping it off" promises to complicate life even more (time zones can be in different formats. Eg : EET, -330, +710, etc)