{
    "content": [
        {
            "type": "text",
            "text": "# MIME::WordDecoder (perldoc)\n\n## NAME\n\nMIME::WordDecoder - decode RFC 2047 encoded words to a local representation  WARNING: Most of this module is deprecated and may disappear. The only function you should use for MIME decoding is \"mimetoperlstring\".\n\n## SYNOPSIS\n\nSee MIME::Words for the basics of encoded words. See \"DESCRIPTION\" for how this class works.\nuse MIME::WordDecoder;\n### Get the default word-decoder (used by unmime()):\n$wd = default MIME::WordDecoder;\n### Get a word-decoder which maps to ISO-8859-1 (Latin1):\n$wd = supported MIME::WordDecoder \"ISO-8859-1\";\n### Decode a MIME string (e.g., into Latin1) via the default decoder:\n$str = $wd->decode('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n### Decode a string using the default decoder, non-OO style:\n$str = unmime('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n### Decode a string to an internal Perl string, non-OO style\n### The result is likely to have the UTF8 flag ON.\n$str = mimetoperlstring('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n\n## DESCRIPTION\n\nWARNING: Most of this module is deprecated and may disappear. It duplicates (badly) the function\nof the standard 'Encode' module. The only function you should rely on is mimetoperlstring.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PUBLIC INTERFACE**\n- **SUBCLASSES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "MIME::WordDecoder",
        "section": "",
        "mode": "perldoc",
        "summary": "MIME::WordDecoder - decode RFC 2047 encoded words to a local representation  WARNING: Most of this module is deprecated and may disappear. The only function you should use for MIME decoding is \"mimetoperlstring\".",
        "synopsis": "See MIME::Words for the basics of encoded words. See \"DESCRIPTION\" for how this class works.\nuse MIME::WordDecoder;\n### Get the default word-decoder (used by unmime()):\n$wd = default MIME::WordDecoder;\n### Get a word-decoder which maps to ISO-8859-1 (Latin1):\n$wd = supported MIME::WordDecoder \"ISO-8859-1\";\n### Decode a MIME string (e.g., into Latin1) via the default decoder:\n$str = $wd->decode('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n### Decode a string using the default decoder, non-OO style:\n$str = unmime('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n### Decode a string to an internal Perl string, non-OO style\n### The result is likely to have the UTF8 flag ON.\n$str = mimetoperlstring('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 44,
                "subsections": []
            },
            {
                "name": "PUBLIC INTERFACE",
                "lines": 72,
                "subsections": []
            },
            {
                "name": "SUBCLASSES",
                "lines": 42,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "MIME::WordDecoder - decode RFC 2047 encoded words to a local representation\n\nWARNING: Most of this module is deprecated and may disappear. The only function you should use\nfor MIME decoding is \"mimetoperlstring\".\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "See MIME::Words for the basics of encoded words. See \"DESCRIPTION\" for how this class works.\n\nuse MIME::WordDecoder;\n\n\n### Get the default word-decoder (used by unmime()):\n$wd = default MIME::WordDecoder;\n\n### Get a word-decoder which maps to ISO-8859-1 (Latin1):\n$wd = supported MIME::WordDecoder \"ISO-8859-1\";\n\n\n### Decode a MIME string (e.g., into Latin1) via the default decoder:\n$str = $wd->decode('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n\n### Decode a string using the default decoder, non-OO style:\n$str = unmime('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n\n### Decode a string to an internal Perl string, non-OO style\n### The result is likely to have the UTF8 flag ON.\n$str = mimetoperlstring('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "WARNING: Most of this module is deprecated and may disappear. It duplicates (badly) the function\nof the standard 'Encode' module. The only function you should rely on is mimetoperlstring.\n\nA MIME::WordDecoder consists, fundamentally, of a hash which maps a character set name\n(US-ASCII, ISO-8859-1, etc.) to a subroutine which knows how to take bytes in that character set\nand turn them into the target string representation. Ideally, this target representation would\nbe Unicode, but we don't want to overspecify the translation that takes place: if you want to\nconvert MIME strings directly to Big5, that's your own decision.\n\nThe subroutine will be invoked with two arguments: DATA (the data in the given character set),\nand CHARSET (the upcased character set name).\n\nFor example:\n\n### Keep 7-bit characters as-is, convert 8-bit characters to '#':\nsub keep7bit {\nlocal $ = shift;\ntr/\\x00-\\x7F/#/c;\n$;\n}\n\nHere's a decoder which uses that:\n\n### Construct a decoder:\n$wd = MIME::WordDecoder->new({'US-ASCII'   => \"KEEP\",   ### sub { $[0] }\n'ISO-8859-1' => \\&keep7bit,\n'ISO-8859-2' => \\&keep7bit,\n'Big5'       => \"WARN\",\n'*'          => \"DIE\"});\n\n### Convert some MIME text to a pure ASCII string...\n$ascii = $wd->decode('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n\n### ...which will now hold: \"To: Keld J#rn Simonsen <keld>\"\n\nThe UTF-8 built-in decoder decodes everything into Perl's internal string format, possibly\nturning on the internal UTF8 flag. Use it like this:\n\n$wd = supported MIME::WordDecoder 'UTF-8';\n$perlstring = $wd->decode('To: =?ISO-8859-1?Q?KeldJ=F8rnSimonsen?= <keld>');\n# perlstring will be a valid UTF-8 string with the \"UTF8\" flag set.\n\nGenerally, you should use the UTF-8 decoder in preference to \"unmime\".\n",
                "subsections": []
            },
            "PUBLIC INTERFACE": {
                "content": "default [DECODER]\n*Class method.* Get/set the default DECODER object.\n\nsupported CHARSET, [DECODER]\n*Class method.* If just CHARSET is given, returns a decoder object which maps data into that\ncharacter set (the character set is forced to all-uppercase).\n\n$wd = supported MIME::WordDecoder \"ISO-8859-1\";\n\nIf DECODER is given, installs such an object:\n\nMIME::WordDecoder->supported(\"ISO-8859-1\" =>\n(new MIME::WordDecoder::ISO8859 \"1\"));\n\nYou should not override this method.\n\nnew [\\@HANDLERS]\n*Class method, constructor.* If \\@HANDLERS is given, then @HANDLERS is passed to handler()\nto initialize the internal map.\n\nhandler CHARSET=>\\&SUBREF, ...\n*Instance method.* Set the handler SUBREF for a given CHARSET, for as many pairs as you care\nto supply.\n\nWhen performing the translation of a MIME-encoded string, a given SUBREF will be invoked\nwhen translating a block of text in character set CHARSET. The subroutine will be invoked\nwith the following arguments:\n\nDATA    - the data in the given character set.\nCHARSET - the upcased character set name, which may prove useful\nif you are using the same SUBREF for multiple CHARSETs.\nDECODER - the decoder itself, if it contains configuration information\nthat your handler function needs.\n\nFor example:\n\n$wd = new MIME::WordDecoder;\n$wd->handler('US-ASCII'   => \"KEEP\");\n$wd->handler('ISO-8859-1' => \\&handlelatin1,\n'ISO-8859-2' => \\&handlelatin1,\n'*'          => \"DIE\");\n\nNotice that, much as with %SIG, the SUBREF can also be taken from a set of special keywords:\n\nKEEP     Pass data through unchanged.\nIGNORE   Ignore data in this character set, without warning.\nWARN     Ignore data in this character set, with warning.\nDIE      Fatal exception with \"can't handle character set\" message.\n\nThe subroutine for the special CHARSET of 'raw' is used for raw (non-MIME-encoded) text,\nwhich is supposed to be US-ASCII. The handler for 'raw' defaults to whatever was specified\nfor 'US-ASCII' at the time of construction.\n\nThe subroutine for the special CHARSET of '*' is used for any unrecognized character set.\nThe default action for '*' is WARN.\n\ndecode STRING\n*Instance method.* Decode a STRING which might contain MIME-encoded components into a local\nrepresentation (e.g., UTF-8, etc.).\n\nunmime STRING\n*Function, exported.* Decode the given STRING using the default() decoder. See default().\n\nYou should consider using the UTF-8 decoder instead. It decodes MIME strings into Perl's\ninternal string format.\n\nmimetoperlstring\n*Function, exported.* Decode the given STRING into an internal Perl Unicode string. You\nshould use this function in preference to all others.\n\nThe result of mimetoperlstring is likely to have Perl's UTF8 flag set.\n",
                "subsections": []
            },
            "SUBCLASSES": {
                "content": "MIME::WordDecoder::ISO8859\nA simple decoder which keeps US-ASCII and the 7-bit characters of ISO-8859 character sets\nand UTF8, and also keeps 8-bit characters from the indicated character set.\n\n### Construct:\n$wd = new MIME::WordDecoder::ISO8859 2;    ### ISO-8859-2\n\n### What to translate unknown characters to (can also use empty):\n### Default is \"?\".\n$wd->unknown(\"?\");\n\n### Collapse runs of unknown characters to a single unknown()?\n### Default is false.\n$wd->collapse(1);\n\nAccording to http://czyborra.com/charsets/iso8859.html (ca. November 2000):\n\nISO 8859 is a full series of 10 (and soon even more) standardized multilingual single-byte\ncoded (8bit) graphic character sets for writing in alphabetic languages:\n\n1. Latin1 (West European)\n2. Latin2 (East European)\n3. Latin3 (South European)\n4. Latin4 (North European)\n5. Cyrillic\n6. Arabic\n7. Greek\n8. Hebrew\n9. Latin5 (Turkish)\n10. Latin6 (Nordic)\n\nThe ISO 8859 charsets are not even remotely as complete as the truly great Unicode but they\nhave been around and usable for quite a while (first registered Internet charsets for use\nwith MIME) and have already offered a major improvement over the plain 7bit US-ASCII.\n\nCharacters 0 to 127 are always identical with US-ASCII and the positions 128 to 159 hold\nsome less used control characters: the so-called C1 set from ISO 6429.\n\nMIME::WordDecoder::USASCII\nA subclass of the ISO-8859-1 decoder which discards 8-bit characters. You're probably better\noff using ISO-8859-1.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "MIME::Tools\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Eryq (eryq@zeegee.com), ZeeGee Software Inc (http://www.zeegee.com). Dianne Skoll\n(dfs@roaringpenguin.com) http://www.roaringpenguin.com\n",
                "subsections": []
            }
        }
    }
}