Skip to content

whois: Invalid charset for response

As if MacOS didn't have enough charset problems, here's another one:
$ /usr/bin/whois denic.de
% Error: 55000000013 Invalid charset for response
Although the problem has been reported to DENIC years ago, they still send out UTF-8 data if the handles contain e.g. umlauts.

But why can't the MacOS version of whois(1) handle UTF-8 data? A quick look on the binary reveals:
$ strings /usr/bin/whois
[...]
de.whois-servers.net
-T dn,ace -C US-ASCII %s
So, the -T dn,ace -C US-ASCII seems to be hardcoded, as we can see in the source:
#define GERMNICHOST	"de.whois-servers.net"
[...]
if (strcmp(hostname, GERMNICHOST) == 0) {
		fprintf(sfo, "-T dn,ace -C US-ASCII %s\r\n", query);
There's no -C switch to pass to whois(1) to change this behaviour. Experimenting with LC_ALL environment variables did not help either.

What did help was to pass options directly to their whois server
$ /usr/bin/whois -h whois.denic.de -- "-T dn,ace denic.de"
This way, -C US-ASCII is skipped and the (UTF-8) output can be displayed just fine.

Of course, we could also install whois from Macports, it seems to handle UTF-8 data just fine (although it had a similar problem years ago):
$ sudo port install whois

$ /opt/local/bin/whois denic.de | file -
/dev/stdin: UTF-8 Unicode text

$ /opt/local/bin/whois denic.de
[...]
[Tech-C]
Type: PERSON
Name: Business Services
Organisation: DENIC eG
Address: Kaiserstraße 75-77

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Form options