On 2017/07/11 16:19, Ingo Schwarze wrote: > This decade feels like a strange point in time for degrading fortune > and calendar files by replacing UTF-8 characters with ASCII > transcriptions. Maybe such games should call > > setlocale(LC_CTYPE, ""); > char *loc = nl_langinfo(CODESET); > > and replace bytes that are not printable ASCII with question marks > when loc doesn't contain UTF-8? Not sure.
Given that we don't have http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html, that seems better to me than either indiscriminately printing UTF-8 to a terminal expecting ASCII, or quietly mangling output. But then, how far should one go? ls(1) can have the same problem with an incompatible terminal.
