On Mon, Aug 11, 2014 at 12:12:08PM +0100, Stuart Henderson wrote: > Another question is what to do with (increasingly common) unicode > SSIDs, we could probably do better than the existing "if (buf[i] & 0x80 > || !isprint(buf[i]))" if we know that we're in a utf8 locale.
I'm not opposed to making ifconfig display UTF-8 SSIDs in the UTF-8 locale. This would require passing every SSID with high bits set through a UTF-8 parser to check if it is a valid UTF-8 string. It it is, print it, otherwise print as hex. We'd probably break some scripts that don't set LC_CTYPE=C. Of course, we won't be able to fit this feature in the ramdisk. And people will be surprised when ksh's editing acts weird after pasting the nwid into a command line but perhaps that's good for progress :) While UTF-8 could be detected reliably, in other cases we'd have to guess the encoding. And we could guess wrong. With single-byte encodings ifconfig might end up displaying the network name in a different encoding, swapping characters. So it's probably best to support only ASCII or UTF-8, if at all.