GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::LIBIDN (3)

.ds Aq ’

NAME

Net::LibIDN - Perl bindings for GNU Libidn

CONTENTS

SYNOPSIS



  use Net::LibIDN :all;

  idn_to_ascii("Raeksmoergaas.Josefsson.ORG") eq
    idn_to_ascii(idn_to_unicode("xn--rksmrgs-5wao1o.josefsson.org"));

  idn_prep_name("LibUeDN") eq "libuedn";

  idn_punycode_encode("kistenmoehre") eq
    idn_punycode_encode(idn_punycode_decode("kistenmhre-kcb"));

  my $errpos;
  tld_check("me\k:`rle.se", $errpos) eq undef;
    $errpos == 1;

  tld_get("mainbase.mars") eq "mars";

  my $hashref = Net::LibIDN::tld_get_table("de");

  print "$hashref->{version}\n";
  foreach (@{$hashref->{valid}})
  {
    print "Unicode range from ".$_->{start}." to ".$_->{end}."\n";
  }



DESCRIPTION

Provides bindings for GNU Libidn, a C library for handling Internationalized Domain Names according to IDNA (RFC 3490), in a way very much inspired by Turbo Fredriksson’s PHP-IDN.

    Functions

<B>Net::LibIDN::idn_to_asciiB>($clear_hostname, [$charset, [$flags]]); Converts $clear_hostname which might contain characters outside the range allowed in DNS names, to IDNA ACE. If $charset is specified, treats string as being encoded in it, otherwise assumes it is ISO-8859-1 encoded. If flag <B>IDNA_ALLOW_UNASSIGNEDB> is set in $flags, accepts also unassigned Unicode characters, if <B>IDNA_USE_STD3_ASCII_RULESB> is set, accepts only ASCII LDH characters (letter-digit-hyphen). Flags can be combined with ||. Returns result of conversion or <B>undefB> on error.
<B>Net::LibIDN::idn_to_unicodeB>($idn_hostname, [$charset, [$flags]]); Converts ASCII $idn_hostname, which might be IDNA ACE encoded, into the decoded form in $charset or ISO-8859-1. Flags are interpreted as above. Returns result of conversion or <B>undefB> on error.
<B>Net::LibIDN::idn_punycode_encodeB>($string, [$charset]); Encodes $string into punycode (RFC 3492). If $charset is present, treats $string as being in $charset, otherwise uses ISO-8859-1. Returns result of conversion or <B>undefB> on error.
<B>Net::LibIDN::idn_punycode_decodeB>($string, [$charset]); Decodes $string from punycode (RFC 3492). If $charset is present, result is converted to $charset, otherwise it is converted to ISO-8859-1. Returns result of conversion or <B>undefB> on error.
<B>Net::LibIDN::idn_prep_nameB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_kerberos5B>($string, [$charset]);
<B>Net::LibIDN::idn_prep_nodeB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_resourceB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_plainB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_traceB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_saslB>($string, [$charset]);
<B>Net::LibIDN::idn_prep_iscsiB>($string, [$charset]); Performs stringprep (RFC 3454) on $string according to the named profile (e.g. *_name -> nameprep (RFC 3491)). If $charset is present, converts from and to this charset before and after the operation respectively. Returns result string, or <B>undefB> on error.
<B>Net::LibIDN::tdl_checkB>($string, $errpos, [$charset, [$tld]]); Checks whether or not $string conforms to the restrictions on the sets of valid characters defined by TLD authorities around the World. Treats $string as a hostname if $tld is not present, determining the TLD from the hostname. If $tld is present, uses the restrictions defined by the parties responsible for TLD $tld. $charset may be used to specify the character set the $string is in. Should an invalid character be detected, returns 0 and the 0-based position of the offending character in $errpos. In case of other failure conditions, $errpos is not touched, and <B>undefB> is returned. Should $string conform to the TLD restrictions, 1 is returned.
<B>Net::LibIDN::tld_getB>($hostname); Returns top level domain of $hostname, or <B>undefB> if an error occurs or if no top level domain was found.
<B>Net::LibIDN::tld_get_tableB>($tld); Retrieves a hash reference with the TLD restriction info of given TLD $tld, or <B>undefB> if $tld is not found. The hash ref contains the following fields:
o $h->{name} ... name of TLD
o $h->{version} ... version string of this restriction table
o $h->{nvalid} ... number of Unicode intervals
o $h->{valid} ... [ {start => number, end => number}, ...] ... Unicode intervals

    Limitations

There is currently no support for Perl’s unicode capabilities (man perlunicode). All input strings are assumed to be octet strings, all output strings are generated as octet strings. Thus, if you require Perl’s unicode features, you will have to convert your strings manually. For example:

use Encode;

use Data::Dumper;

print Dumper(Net::LibIDN::idn_to_unicode(’xn—uro-j50a.com’, ’utf-8’));

print Dumper(decode(’utf-8’, Net::LibIDN::idn_to_unicode(’xn—uro-j50a.com’, ’utf-8’)));

AUTHOR

Thomas Jacob, http://internet24.de

SEE ALSO

perl(1), RFC 3454, RFC 3490-3492, http://www.gnu.org/software/libidn.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 LIBIDN (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.