Package: whois
Version: 4.7.20
Severity: minor
Tags: patch

When I perform a whois query for a .de domain (for example nic.de or
xn--ko-eka.de), without any additional option, the whois client sends the '-C'
parameter, with the value 'US-ASCII', regardless of the current local encoding.
But whois.denic.de provides information containing signs outside of the ascii
character set, in utf-8 by default, as described in[1].
So the result may contain mutilated characters.

To solve this problem first the local encoding should be examined and      
according to the local encoding the query should be generated.
The attached patch is intended to solve this problem.

Regards
Pascal

1 http://www.denic.de/en/domains/technik/denic_whois-server/index.html

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18.k7
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages whois depends on:
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries
ii  libidn11                     0.6.5-1     GNU libidn library, implementation

whois recommends no packages.

-- no debconf information
--- whois-4.7.20.org/whois.c	2006-11-24 09:33:53.000000000 +0100
+++ whois-4.7.20/whois.c	2006-12-09 16:07:55.000000000 +0100
@@ -22,6 +22,7 @@
 #include <netdb.h>
 #include <errno.h>
 #include <signal.h>
+#include <langinfo.h>
 #ifdef HAVE_GETOPT_LONG
 #include <getopt.h>
 #endif
@@ -466,9 +467,13 @@
      * Do this only if the user did not use any flag.
      */
     if (streq(server, "whois.denic.de") && domcmp(query, ".de")
-	    && !strchr(query, ' ') && !*flags)
-	sprintf(buf, "-T dn,ace -C US-ASCII %s", query);
-    else
+	    && !strchr(query, ' ') && !*flags) {
+	char *codeset = nl_langinfo(CODESET);
+	if (streq(codeset, "UTF-8") || streq(codeset, "ISO-8859-1"))
+	    sprintf(buf, "-T dn,ace -C %s %s", codeset, query);
+	else
+	    sprintf(buf, "-T dn,ace -C US-ASCII %s", query);
+    } else
     /* here we have another registrar who could not make things simple
      * -C sets the language for both input and output
      */

Reply via email to