On 02-03-26 12:09:59 CET, Robert Joop wrote:
> On 02-03-25 18:03:56 CET, Stephen Sprunk wrote:
> > Here's the more interesting question: why do we have a switch for
> > UTF-8 encoding, instead of determining it from the user's locale?
> 
> what is the canonical way to detect this?

following up to myself...

one can find a number of recipes here:
http://www.cl.cam.ac.uk/~mgk25/unicode.html#activate

> the -utf8 should be left there anyway as an additional option,
> because some systems don't have proper locale software?

while this is quite elegant:

#include <locale.h>
#include <langinfo.h>
main()
{
  setlocale (LC_CTYPE, "");
  printf ("cs=%s\n", nl_langinfo (CODESET));
}

it doesn't work on freeBSD (it lacks nl_langinfo()).

rj
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to