Proposal: ext/idn (GNU Libidn)
| From: | Johannes Schlueter | Date: | Sat, 24 Apr 2004 15:54:24 +0000 |
| Subject: | Proposal: ext/idn (GNU Libidn) | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-568@lists.php.net to get a copy of this message | ||
His Majesty, King Wez of PECL,
Ladies and Gentlemen,
Guys,
I've written a small PHP Extension which uses GNU Libidn[1] for converting
domainnames from UTF-8 encoding to ASCII compatible Punycode, like it is used
for the DNS. I'd like to propose it as a PECL package . I'M not uqite sure
which category fits well. Is it i18n or Tools an Utilities or something
different? Since GNU Libidn is distributed under the LGPL I've chosen to use
LGPL, too. Afaik this is possible for PECL packages.
At my site on you can find the archive extracted[2] or as tar.gz[3]. The
complete README follows after this text. It was tested an developed on a
Linux box with PHP4 and 5.
Maybe I'll implement other parts of Libidn later. The TLD stuff in there looks
quite interesting (Which Unicode characters are allowed with which TLD?)
johannes
[1] http://www.gnu.org/software/libidn/
[2] http://schlueters.de/phpstuff/idn/
[3] http://schlueters.de/phpstuff/idn/idn-0.1.tar.gz
ext/idn - PHP Extension for GNU Libidn
Abstract:
---------
This extension gives access to the GNU Libidn. "GNU Libidn is an
implementation of the Stringprep, Punycode and IDNA specifications defined
by the IETF Internationalized Domain Names (IDN) working group, used for
internationalized domain names which is available under the GNU Lesser
General Public License."
More information on GNU Libidn can be found on he GNU website at
http://www.gnu.org/software/libidn/
License:
--------
GNU Lesser Public License
Requirements:
-------------
GNU Libidn (only version tested: 0.3.7)
Install:
--------
Either using the PEAR Installer:
$ pear install idn-x.y.tar.gz
Or by hand:
$ tar xvzf idn-x.y.tar.gz
$ cd idn-x.y
$ phpize
$ ./configure --with-idn
$ make
$ make install
Usage:
------
This extension exports currently two functions. The first converts an UTF-8
encoded domain name to it's corresponding Punycode representation, the other
converts the Punycode version to UTF-8 encoding. The functions return a
string on success and FALSE when an error happens. An errorcode
can be retrieved by passing a second parameter by reference.
Example:
--------
<?php
$in = 'www.éöäè.com';
echo idn_to_ascii(utf8_encode($in)); // echos www.xn--4caib6c.com
$in = 'www.xn--4caib6c.com';
echo utf8_decode(idn_to_utf8($in)); // echos www.éöäè.com
?>
Author:
-------
Johannes Schlueter
schlueter at phpbar then a dot, followed by the TLD for Germany, de.