Blob Blame History Raw
From 58e1af6ca75d035b6391708be2c2272bb8d04620 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@sury.org>
Date: Sun, 4 Nov 2018 02:20:41 +0700
Subject: [PATCH] Enable IDN processing (both idnin and idnout) only on tty,
 disable it when the stdout is not a tty

(cherry picked from commit 0e1bf7d017e4f6d787cbeb72cc2aa74e7f30122e)
(cherry picked from commit 8e1cc95c943b7dfaaaaf2d9a4971861735cc3fb2)
---
 bin/dig/dighost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 74791d671e..3b722ba0ff 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -825,7 +825,7 @@ make_empty_lookup(void) {
 	looknew->seenbadcookie = false;
 	looknew->badcookie = true;
 #ifdef WITH_IDN_SUPPORT
-	looknew->idnin = (getenv("IDN_DISABLE") == NULL);
+	looknew->idnin = isatty(1)?(getenv("IDN_DISABLE") == NULL):false;
 	if (looknew->idnin) {
 		const char *charset = getenv("CHARSET");
 		if (charset && !strcmp(charset, "ASCII"))
-- 
2.20.1