summaryrefslogtreecommitdiffstats
path: root/contrib/publicsuffix/idn.pl
blob: dd46d652ac7ee5d47cf4e2d60b78089267facd3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 $_;
}