Net::IDN::UTS46(3)

NAME
Net::IDN::UTS46 - Unicode IDNA Compatibility Processing (UTS #46)

SYNOPSIS
  use Net::IDN:: ':all';
  my $a = uts46_to_ascii("müller.example.org");
  my $b = Net::IDN::UTS46::to_unicode('EXAMPLE.XN--11B5BS3A9AJ6G');

  $domain =~ m/\P{Net::IDN::UTS46::IsDisallowed} and die 'oops';

DESCRIPTION
This module implements the Unicode Technical Standard #46 (Unicode IDNA Compatibility Processing). UTS #46 is one variant of Internationalized Domain Names (IDN), which aims to be compatible with domain names registered under either IDNA2003 or IDNA2008.

You should use this module if you want an exact implementation of the UTS #46 specification.

However, if you just want to convert domain names and don't care which standard is used internally, you should use Net::IDN::Encode instead.

FUNCTIONS
By default, this module does not export any subroutines. You may use the ":all" tag to import everything.

You can omit the 'uts46_' prefix when accessing the functions with a full-qualified module name (e.g. you can access "uts46_to_unicode" as "Net::IDN::UTS46::uts46_to_unicode" or "Net::IDN::UTS46::to_unicode".

The following functions are available:

uts46_to_ascii( $domain, %param )
    Implements the "ToASCII" function from UTS #46, section 4.2. It converts a domain name to ASCII and throws an exception on invalid input.

    This function takes the following optional parameters (%param):

    AllowUnassigned
        (boolean) If set to a true value, unassigned code points in the label are allowed. This is an extension over UTS #46.

        The default is false.

    UseSTD3ASCIIRules
        (boolean) If set to a true value, checks the label for compliance with STD 3 (RFC 1123) syntax for host name parts.

        The default is true.

    TransitionalProcessing
        (boolean) If set to true, the conversion will be compatible with IDNA2003. This only affects four characters: 'ß' (U+00DF), 'ς' (U+03C2), ZWJ (U+200D) and ZWNJ (U+200C). Usually, you will want to set this to false.

        The default is false.

uts46_to_unicode( $label, %param )
    Implements the "ToUnicode" function from UTS #46, section 4.3. It converts a domain name to Unicode and throws an exception on invalid input.

    This function takes the following optional parameters (%param):

    AllowUnassigned
          see above.

    UseSTD3ASCIIRules
          see above.

    TransitionalProcessing
        (boolean) If given, this parameter must be false. The UTS #46 specification does not define transitional processing for ToUnicode.

UNICODE CHARACTER PROPERTIES
This module also defines the character properties listed below.

Each character has exactly one of the following properties:

"\p{Net::IDN::UTS46::IsValid}"
    The code point is valid, and not modified (i.e. a deviation character) in UTS #46.

"\p{Net::IDN::UTS46::IsIgnored}"
    The code point is removed (i.e. mapped to an empty string) in UTS #46.

"\p{Net::IDN::UTS46::IsMapped}"
    The code point is replaced by another string in UTS #46.

"\p{Net::IDN::UTS46::IsDeviation}"
    The code point is either mapped or valid, depending on whether the processing is transitional or not.

"\p{Net::IDN::UTS46::IsDisallowed}"
    The code point is not allowed in UTS #46.

"\p{Net::IDN::UTS46::IsDisallowedSTD3Ignored}"
    The code point is not allowed in UTS #46 if "UseSTDASCIIRules" are used but would be ignored otherwise.

"\p{Net::IDN::UTS46::IsDisallowedSTD3Mapped}"
    The code point is not allowed in UTS #46 if "UseSTDASCIIRules" are used but would be mapped otherwise.

AUTHOR
Claus Färber <CFAERBER@cpan.org>

LICENSE
Copyright 2011-2018 Claus Färber.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO
Net::IDN::UTS46::Mapping, Net::IDN::Encode, UTS #46 (<http://www.unicode.org/reports/tr46/>)