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

RE: [idn] UTF-8 / RACE



> If gethostbyname() receives 8-bit text, should it assume that it's
UTF-8, or should it assume that it's in the encoding of the current
locale?  My gut feeling is the latter.  And of course gethostbyname()
should use the same encoding for both the argument and the return value.

It is very unlikely that gethostbyname() or any other function would be able
to make that determination except in simplistic cases. Many operating-system
provided locale models are not thread-safe, and threaded applications then
use other mechanisms that the OS may not be aware of. Internationalization
libraries, as another example, commonly provide their own locale model and
applications will use the library's rather than the OS.

So some encoding transformations will have to be done by the application.
Which does not mean that it may not be a good idea to change gethostbyname()
in some way, for Nameprep for example. I just doubt that one can achieve
full transparency in this case, unfortunately. Applications will need to be
changed.

YA