rspamd/contrib/publicsuffix/idn.pl
Vsevolod Stakhov cba661ad9b [Feature] Add punycoded versions for IDN domains
Issue: #554
Reported by: @moisseev
2016-03-17 11:06:39 +00:00

20 lines
304 B
Perl

#!/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 $_;
}