{
    "mode": "perldoc",
    "parameter": "XML::LibXML::Common",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ALibXML%3A%3ACommon/json",
    "generated": "2026-06-10T23:08:17Z",
    "synopsis": "use XML::LibXML::Common;\n$encodedstring = encodeToUTF8( $nameofencoding, $stingtoencode );\n$decodedstring = decodeFromUTF8($nameofencoding, $stringtodecode );",
    "sections": {
        "NAME": {
            "content": "XML::LibXML::Common - Constants and Character Encoding Routines\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use XML::LibXML::Common;\n\n$encodedstring = encodeToUTF8( $nameofencoding, $stingtoencode );\n$decodedstring = decodeFromUTF8($nameofencoding, $stringtodecode );\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "XML::LibXML::Common defines constants for all node types and provides interface to libxml2\ncharset conversion functions.\n\nSince XML::LibXML use their own node type definitions, one may want to use XML::LibXML::Common\nin its compatibility mode:\n",
            "subsections": [
                {
                    "name": "Exporter TAGS",
                    "content": "use XML::LibXML::Common qw(:libxml);\n\n\":libxml\" tag will use the XML::LibXML Compatibility mode, which defines the old 'XML'\nnode-type definitions.\n\nuse XML::LibXML::Common qw(:gdome);\n\n\":gdome\" tag will use the XML::GDOME Compatibility mode, which defines the old 'GDOME'\nnode-type definitions.\n\nuse XML::LibXML::Common qw(:w3c);\n\nThis uses the nodetype definition names as specified for DOM.\n\nuse XML::LibXML::Common qw(:encoding);\n\nThis tag can be used to export only the charset encoding functions of XML::LibXML::Common.\n"
                },
                {
                    "name": "Exports",
                    "content": "By default the W3 definitions as defined in the DOM specifications and the encoding functions\nare exported by XML::LibXML::Common.\n"
                },
                {
                    "name": "Encoding functions",
                    "content": "To encode or decode a string to or from UTF-8, XML::LibXML::Common exports two functions, which\nprovide an interface to the encoding support in \"libxml2\". Which encodings are supported by\nthese functions depends on how \"libxml2\" was compiled. UTF-16 is always supported and on most\ninstallations, ISO encodings are supported as well.\n\nThis interface was useful for older versions of Perl. Since Perl >= 5.8 provides similar\nfunctions via the \"Encode\" module, it is probably a good idea to use those instead.\n\nencodeToUTF8\n$encodedstring = encodeToUTF8( $nameofencoding, $stingtoencode );\n\nThe function will convert a byte string from the specified encoding to an UTF-8 encoded\ncharacter string.\n\ndecodeToUTF8\n$decodedstring = decodeFromUTF8($nameofencoding, $stringtodecode );\n\nThis function converts an UTF-8 encoded character string to a specified encoding. Note that\nthe conversion can raise an error if the given string contains characters that cannot be\nrepresented in the target encoding.\n\nBoth these functions report their errors on the standard error. If an error occurs the function\nwill croak(). To catch the error information it is required to call the encoding function from\nwithin an eval block in order to prevent the entire script from being stopped on encoding error.\n\nA note on history\nBefore XML::LibXML 1.70, this class was available as a separate CPAN distribution, intended to\nprovide functionality shared between XML::LibXML, XML::GDOME, and possibly other modules. Since\nthere seems to be no progress in this direction, we decided to merge XML::LibXML::Common 0.13\nand XML::LibXML 1.70 to one CPAN distribution.\n\nThe merge also naturally eliminates a practical and urgent problem experienced by many\nXML::LibXML users on certain platforms, namely mysterious misbehavior of XML::LibXML occurring\nif the installed (often pre-packaged) version of XML::LibXML::Common was compiled against an\nolder version of libxml2 than XML::LibXML.\n"
                }
            ]
        },
        "AUTHORS": {
            "content": "Matt Sergeant, Christian Glahn, Petr Pajas\n",
            "subsections": []
        },
        "VERSION": {
            "content": "2.0134\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "2001-2007, AxKit.com Ltd.\n\n2002-2006, Christian Glahn.\n\n2006-2009, Petr Pajas.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "XML::LibXML::Common - Constants and Character Encoding Routines",
    "flags": [],
    "examples": [],
    "see_also": []
}