[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [idn] The layers and character handling in DNS



> How does gethostbyname() *know for sure* what the character set of its
> argument is?  Answer: it doesn't, because there is no way that it can.

Let me suggest a different answer:

gethostbyname() knows what the character set of the argument is
because, by definition, it is ASCII.

it's a bad idea to try to change this, because if you do, you break 
one of the assumptions on which code that uses gethostbyname 
was written.  you also create new failure modes which existing
code does not anticipate.

(as another example - when the ctype macros/functions were made 
locale-specific, it broke code that was using them to try to parse 
protocol elements that required ASCII. )

if you want an interface to look up addresses from IDNs - whether it be 
in native format, UTF-8, or whatever - you need a different function.
don't overload gethostbyname.

but don't try to retroactively change an existing interface.

Keith