summaryrefslogtreecommitdiffstats
path: root/contrib/publicsuffix/idn.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
commit133a45c109da5310add55824db21af5239951f93 (patch)
treeba6ac4c0a950a0dda56451944315d66409923918 /contrib/publicsuffix/idn.pl
parentInitial commit. (diff)
downloadrspamd-133a45c109da5310add55824db21af5239951f93.tar.xz
rspamd-133a45c109da5310add55824db21af5239951f93.zip
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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 0000000..dd46d65
--- /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