{
    "mode": "perldoc",
    "parameter": "Unicode::Stringprep",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Unicode%3A%3AStringprep/json",
    "generated": "2026-10-05T15:14:31Z",
    "synopsis": "use Unicode::Stringprep;\nuse Unicode::Stringprep::Mapping;\nuse Unicode::Stringprep::Prohibited;\nmy $prepper = Unicode::Stringprep->new(\n3.2,\n[ { 32 => '<SPACE>'},  ],\n'KC',\n[ @Unicode::Stringprep::Prohibited::C12, @Unicode::Stringprep::Prohibited::C22,\n@Unicode::Stringprep::Prohibited::C3, @Unicode::Stringprep::Prohibited::C4,\n@Unicode::Stringprep::Prohibited::C5, @Unicode::Stringprep::Prohibited::C6,\n@Unicode::Stringprep::Prohibited::C7, @Unicode::Stringprep::Prohibited::C8,\n@Unicode::Stringprep::Prohibited::C9 ],\n1, 0 );\n$output = $prepper->($input)",
    "sections": {
        "NAME": {
            "content": "Unicode::Stringprep - Preparation of Internationalized Strings (RFC 3454)\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Unicode::Stringprep;\nuse Unicode::Stringprep::Mapping;\nuse Unicode::Stringprep::Prohibited;\n\nmy $prepper = Unicode::Stringprep->new(\n3.2,\n[ { 32 => '<SPACE>'},  ],\n'KC',\n[ @Unicode::Stringprep::Prohibited::C12, @Unicode::Stringprep::Prohibited::C22,\n@Unicode::Stringprep::Prohibited::C3, @Unicode::Stringprep::Prohibited::C4,\n@Unicode::Stringprep::Prohibited::C5, @Unicode::Stringprep::Prohibited::C6,\n@Unicode::Stringprep::Prohibited::C7, @Unicode::Stringprep::Prohibited::C8,\n@Unicode::Stringprep::Prohibited::C9 ],\n1, 0 );\n$output = $prepper->($input)\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module implements the *stringprep* framework for preparing Unicode text strings in order to\nincrease the likelihood that string input and string comparison work in ways that make sense for\ntypical users throughout the world. The *stringprep* protocol is useful for protocol identifier\nvalues, company and personal names, internationalized domain names, and other text strings.\n\nThe *stringprep* framework does not specify how protocols should prepare text strings. Protocols\nmust create profiles of stringprep in order to fully specify the processing options.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "This module provides a single function, \"new\", that creates a perl function implementing a\n*stringprep* profile.\n\nThis module exports nothing.\n",
            "subsections": [
                {
                    "name": "new",
                    "content": "$unassignedcheck)\nCreates a \"bless\"ed function reference that implements a stringprep profile.\n\nThis function takes the following parameters:\n\n$unicodeversion\nThe Unicode version specified by the stringprep profile.\n\nCurrently, this parameter must be 3.2 (numeric).\n\n$mappingtables\nThe mapping tables used for stringprep.\n\nThe parameter may be a reference to a hash or an array, or \"undef\". A hash must map\nUnicode codepoints (as integers, e. g. 0x0020 for U+0020) to replacement strings (as\nperl strings). An array may contain pairs of Unicode codepoints and replacement strings\nas well as references to nested hashes and arrays.\n\nUnicode::Stringprep::Mapping provides the tables from RFC 3454, Appendix B.\n\nFor further information on the mapping step, see RFC 3454, section 3.\n\n$unicodenormalization\nThe Unicode normalization to be used.\n\nCurrently, \"undef\"/'' (no normalization) and 'KC' (compatibility composed) are specified\nfor *stringprep*.\n\nFor further information on the normalization step, see RFC 3454, section 4.\n\nNormalization form KC will also enable checks for some problem sequences for which the\nnormalization can't be implemented in an interoperable way.\n\nFor more information, see \"CAVEATS\" below.\n\n$prohibitedtables\nThe list of prohibited output characters for stringprep.\n\nThe parameter may be a reference to an array, or \"undef\". The array contains pairs of\ncodepoints, which define the start and end of a Unicode character range (as integers).\nThe end character may be \"undef\", specifying a single-character range. The array may\nalso contain references to nested arrays.\n\nUnicode::Stringprep::Prohibited provides the tables from RFC 3454, Appendix C.\n\nFor further information on the prohibition checking step, see RFC 3454, section 5.\n\n$bidicheck\nWhether to employ checks for confusing bidirectional text. A boolean value.\n\nFor further information on the bidi checking step, see RFC 3454, section 6.\n\n$unassignedcheck\nWhether to check for and prohibit unassigned characters. A boolean value.\n\nThe check must be used when creating *stored* strings. It should not be used for *query*\nstrings, increasing the chance that newly assigned characters work as expected.\n\nFor further information on *stored* and *query* strings, see RFC 3454, section 7.\n\nThe function returned can be called with a single parameter, the string to be prepared, and\nreturns the prepared string. It will die if the input string cannot be successfully prepared\nbecause it would contain invalid output (so use \"eval\" if necessary).\n\nFor performance reasons, it is strongly recommended to call the \"new\" function as few times\nas possible, i. e. exactly once per *stringprep* profile. It might also be better not to use\nthis module directly but to use (or write) a module implementing a profile, such as\nAuthen::SASL::SASLprep.\n"
                }
            ]
        },
        "IMPLEMENTING PROFILES": {
            "content": "You can easily implement a *stringprep* profile without subclassing:\n\npackage ACME::ExamplePrep;\n\nuse Unicode::Stringprep;\n\nuse Unicode::Stringprep::Mapping;\nuse Unicode::Stringprep::Prohibited;\n\n*exampleprep = Unicode::Stringprep->new(\n3.2,\n[ \\@Unicode::Stringprep::Mapping::B1, ],\n'',\n[ \\@Unicode::Stringprep::Prohibited::C12,\n\\@Unicode::Stringprep::Prohibited::C22, ],\n1,\n);\n\nThis binds \"ACME::ExamplePrep::exampleprep\" to the function created by\n\"Unicode::Stringprep->new\".\n\nUsually, it is not necessary to subclass this module. Sublassing this module is not recommended.\n",
            "subsections": []
        },
        "DATA TABLES": {
            "content": "The following modules contain the data tables from RFC 3454. These modules are automatically\nloaded when loading \"Unicode::Stringprep\".\n\n*   Unicode::Stringprep::Unassigned\n\n@Unicode::Stringprep::Unassigned::A1  # Appendix A.1\n\n*   Unicode::Stringprep::Mapping\n\n@Unicode::Stringprep::Mapping::B1     # Appendix B.1\n@Unicode::Stringprep::Mapping::B2     # Appendix B.2\n@Unicode::Stringprep::Mapping::B2     # Appendix B.3\n\n*   Unicode::Stringprep::Prohibited\n\n@Unicode::Stringprep::Prohibited::C11 # Appendix C.1.1\n@Unicode::Stringprep::Prohibited::C12 # Appendix C.1.2\n@Unicode::Stringprep::Prohibited::C21 # Appendix C.2.1\n@Unicode::Stringprep::Prohibited::C22 # Appendix C.2.2\n@Unicode::Stringprep::Prohibited::C3  # Appendix C.3\n@Unicode::Stringprep::Prohibited::C4  # Appendix C.4\n@Unicode::Stringprep::Prohibited::C5  # Appendix C.5\n@Unicode::Stringprep::Prohibited::C6  # Appendix C.6\n@Unicode::Stringprep::Prohibited::C7  # Appendix C.7\n@Unicode::Stringprep::Prohibited::C8  # Appendix C.8\n@Unicode::Stringprep::Prohibited::C9  # Appendix C.9\n\n*   Unicode::Stringprep::BiDi\n\n@Unicode::Stringprep::BiDi::D1        # Appendix D.1\n@Unicode::Stringprep::BiDi::D2        # Appendix D.2\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "In Unicode 3.2 to 4.0.1, the specification of UAX #15: Unicode Normalization Forms for forms NFC\nand NFKC is not logically self-consistent. This has been fixed in Corrigendum #5\n(<http://unicode.org/versions/corrigendum5.html>).\n\nUnfortunately, this yields two ways to implement NFC and NFKC in Unicode 3.2, on which the\nStringprep standard is based: one based on a literal interpretation of the original\nspecification and one based on the corrected specification. The output of these implementations\ndiffers for a small class of strings, all of which can't appear in meaningful text. See UAX #15,\nsection 19 <http://unicode.org/reports/tr15/#StabilityPriortoUnicode41> for details.\n\nThis module will check for these strings and, if normalization is done, prohibit them in output\nas it is not possible to interoperate under these circumstandes.\n\nPlease note that due to this, the *normalization* step may cause the preparation to fail. That\nis, the preparation function may die even if there are no prohibited characters and no checks\nfor bidi sequences and unassigned characters, which may be surprising.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Claus Färber <CFAERBER@cpan.org>\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyright 2007-2009 Claus Färber.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Unicode::Normalize, RFC 3454 (<http://www.ietf.org/rfc/rfc3454.txt>)\n",
            "subsections": []
        }
    },
    "summary": "Unicode::Stringprep - Preparation of Internationalized Strings (RFC 3454)",
    "flags": [],
    "examples": [],
    "see_also": []
}