Go through the string looking for RFC 2047-style Q
(quoted-printable, sort of) or B (base64) encoding, and decode them.
<B>In an array context,B> splits the ENCODED string into a list of decoded [DATA, CHARSET] pairs, and returns that list. Unencoded data are returned in a 1-element array [DATA], giving an effective CHARSET of undef.
<B>In a scalar context,B> joins the data elements of the above list together, and returns that. Warning: this is information-lossy, and probably not what you want, but if you know that all charsets in the ENCODED string are identical, it might be useful to you. (Before you use this, please see unmime in MIME::WordDecoder, which is probably what you want.)
In the event of a syntax error, $@ will be set to a description of the error, but parsing will continue as best as possible (so as to get something back when decoding headers). $@ will be false if no error was detected.
Any arguments past the ENCODED string are taken to define a hash of options:
|encode_mimeword RAW, [ENCODING], [CHARSET]||
Encode a single RAW word that has unsafe characters.
The word will be encoded in its entirety.
You may specify the ENCODING ("Q" or "B"), which defaults to "Q". You may specify the CHARSET, which defaults to iso-8859-1.
|encode_mimewords RAW, [OPTS]||
Given a RAW string, try to find and encode all unsafe sequences
Returns the encoded string. Any arguments past the RAW string are taken to define a hash of options:
<B>Warning:B> this is a quick-and-dirty solution, intended for character sets which overlap ASCII. <B>It does not comply with the RFC 2047 rules regarding the use of encoded words in message headersB>. You may want to roll your own variant, using encode_mimeword(), for your application. Thanks to Jan Kasprzak for reminding me about this problem.
MIME::Base64, MIME::QuotedPrint, MIME::Tools
For other implementations of this or similar functionality (particularly, ones with proper UTF8 support), see:
At some future point, one of these implementations will likely replace MIME::Words and MIME::Words will become deprecated.
Exports its principle functions by default, in keeping with MIME::Base64 and MIME::QuotedPrint.
Eryq (firstname.lastname@example.org), ZeeGee Software Inc (http://www.zeegee.com). Dianne Skoll (email@example.com) http://www.roaringpenguin.com
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Thanks also to...
Kent Boortz For providing the idea, and the baseline RFC-1522-decoding code! KJJ at PrimeNet For requesting that this be split into its own module. Stephane Barizien For reporting a nasty bug.
|perl v5.20.3||MIME::WORDS (3)||2015-09-30|