summaryrefslogtreecommitdiffstats
path: root/contrib/publicsuffix/idn.pl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-17 11:06:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-17 11:06:39 +0000
commitcba661ad9bec0e0a8aa9936c88250b64919e2b08 (patch)
tree3f49dc3e5e43ef8c999e42cab5750f64df3ddebf /contrib/publicsuffix/idn.pl
parentf95d64eeed9199947e7428bedd48df853cbfb3b9 (diff)
downloadrspamd-cba661ad9bec0e0a8aa9936c88250b64919e2b08.tar.gz
rspamd-cba661ad9bec0e0a8aa9936c88250b64919e2b08.zip
[Feature] Add punycoded versions for IDN domains
Issue: #554 Reported by: @moisseev
Diffstat (limited to 'contrib/publicsuffix/idn.pl')
-rw-r--r--contrib/publicsuffix/idn.pl20
1 files changed, 20 insertions, 0 deletions
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