From cba661ad9bec0e0a8aa9936c88250b64919e2b08 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 17 Mar 2016 11:06:39 +0000 Subject: [Feature] Add punycoded versions for IDN domains Issue: #554 Reported by: @moisseev --- contrib/publicsuffix/idn.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 contrib/publicsuffix/idn.pl (limited to 'contrib/publicsuffix/idn.pl') diff --git a/contrib/publicsuffix/idn.pl b/contrib/publicsuffix/idn.pl new file mode 100644 index 000000000..dd46d652a --- /dev/null +++ b/contrib/publicsuffix/idn.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl + +use warnings; +use strict; +use Net::IDN::Encode ':all'; +use Unicode::Normalize; + +binmode(STDOUT, ":utf8"); +binmode(STDIN, ":utf8"); + +while (<>) { + $_ = NFC($_); + if (/^[^\/].*[^\x00-\x7F]+.*/) { + chomp; + printf "%s\n", domain_to_ascii($_); + $_ .= "\n"; + } +} continue { + print $_; +} \ No newline at end of file -- cgit v1.2.3