{
    "content": [
        {
            "type": "text",
            "text": "# Text::Iconv (perldoc)\n\n## NAME\n\nText::Iconv - Perl interface to iconv() codeset conversion function\n\n## SYNOPSIS\n\nuse Text::Iconv;\n$converter = Text::Iconv->new(\"fromcode\", \"tocode\");\n$converted = $converter->convert(\"Text to convert\");\n\n## DESCRIPTION\n\nThe Text::Iconv module provides a Perl interface to the iconv() function as defined by the\nSingle UNIX Specification.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (7 subsections)\n- **ERRORS** (4 subsections)\n- **NOTES**\n- **AUTHOR**\n- **SEE ALSO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Text::Iconv",
        "section": "",
        "mode": "perldoc",
        "summary": "Text::Iconv - Perl interface to iconv() codeset conversion function",
        "synopsis": "use Text::Iconv;\n$converter = Text::Iconv->new(\"fromcode\", \"tocode\");\n$converted = $converter->convert(\"Text to convert\");",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": [
                    {
                        "name": "Utility methods",
                        "lines": 2
                    },
                    {
                        "name": "retval",
                        "lines": 10
                    },
                    {
                        "name": "retval",
                        "lines": 1
                    },
                    {
                        "name": "get_attr",
                        "lines": 1
                    },
                    {
                        "name": "convert",
                        "lines": 19
                    },
                    {
                        "name": "set_attr",
                        "lines": 1
                    },
                    {
                        "name": "convert",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "ERRORS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Handling of conversion errors",
                        "lines": 3
                    },
                    {
                        "name": "convert",
                        "lines": 4
                    },
                    {
                        "name": "Per-object handling of conversion errors",
                        "lines": 7
                    },
                    {
                        "name": "Conversion of undef",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "iconv",
                        "lines": 1
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "Text::Iconv - Perl interface to iconv() codeset conversion function\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Text::Iconv;\n$converter = Text::Iconv->new(\"fromcode\", \"tocode\");\n$converted = $converter->convert(\"Text to convert\");\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The Text::Iconv module provides a Perl interface to the iconv() function as defined by the\nSingle UNIX Specification.\n\nThe convert() method converts the encoding of characters in the input string from the *fromcode*\ncodeset to the *tocode* codeset, and returns the result.\n\nSettings of *fromcode* and *tocode* and their permitted combinations are\nimplementation-dependent. Valid values are specified in the system documentation; the iconv(1)\nutility should also provide a -l option that lists all supported codesets.\n",
                "subsections": [
                    {
                        "name": "Utility methods",
                        "content": "Text::Iconv objects also provide the following methods:\n"
                    },
                    {
                        "name": "retval",
                        "content": "according to the Single UNIX Specification, this value indicates \"the number of non-identical\nconversions performed.\" Note, however, that iconv implementations vary widely in the\ninterpretation of this specification.\n\nThis method can be called after calling convert(), e.g.:\n\n$result = $converter->convert(\"lorem ipsum dolor sit amet\");\n$retval = $converter->retval;\n\nWhen called before the first call to convert(), or if an error occured during the conversion,"
                    },
                    {
                        "name": "retval",
                        "content": ""
                    },
                    {
                        "name": "get_attr",
                        "content": "The getattr() method allows you to query various attributes which influence the behavior of"
                    },
                    {
                        "name": "convert",
                        "content": "*discardilseq*, e.g.:\n\n$state = $converter->getattr(\"transliterate\");\n\nSee iconvctl(3) for details. To ensure portability to other iconv implementations you should\nfirst check for the availability of this method using eval {}, e.g.:\n\neval { $conv->getattr(\"trivialp\") };\nif ($@)\n{\n# getattr() is not available\n}\nelse\n{\n# getattr() is available\n}\n\nThis method should be considered experimental.\n"
                    },
                    {
                        "name": "set_attr",
                        "content": "The setattr() method allows you to set various attributes which influence the behavior of"
                    },
                    {
                        "name": "convert",
                        "content": "$state = $converter->setattr(\"transliterate\");\n\nSee iconvctl(3) for details. To ensure portability to other iconv implementations you should\nfirst check for the availability of this method using eval {}, cf. the description of setattr()\nabove.\n\nThis method should be considered experimental.\n"
                    }
                ]
            },
            "ERRORS": {
                "content": "If the conversion can't be initialized an exception is raised (using croak()).\n",
                "subsections": [
                    {
                        "name": "Handling of conversion errors",
                        "content": "*Text::Iconv* provides a class attribute raiseerror and a corresponding class method for\nsetting and getting its value. The handling of errors during conversion depends on the setting\nof this attribute. If raiseerror is set to a true value, an exception is raised; otherwise, the"
                    },
                    {
                        "name": "convert",
                        "content": "Text::Iconv->raiseerror(1);     # Conversion errors raise exceptions\nText::Iconv->raiseerror(0);     # Conversion errors return undef\n$a = Text::Iconv->raiseerror(); # Get current setting\n"
                    },
                    {
                        "name": "Per-object handling of conversion errors",
                        "content": "As an experimental feature, *Text::Iconv* also provides an instance attribute raiseerror and a\ncorresponding method for setting and getting its value. If raiseerror is undef, the class-wide\nsettings apply. If raiseerror is 1 or 0 (true or false), the object settings override the\nclass-wide settings.\n\nConsult iconv(3) for details on errors that might occur.\n"
                    },
                    {
                        "name": "Conversion of undef",
                        "content": "Converting undef, e.g.,\n\n$converted = $converter->convert(undef);\n\nalways returns undef. This is not considered an error.\n"
                    }
                ]
            },
            "NOTES": {
                "content": "The supported codesets, their names, the supported conversions, and the quality of the\nconversions are all system-dependent.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Michael Piotrowski <mxp@dynalabs.de>\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "iconv",
                        "content": ""
                    }
                ]
            }
        }
    }
}