From: Hans de Graaff Date: 2009-05-28T20:15:22+09:00 Subject: [ruby-core:23587] [Bug #1528] setlocale is not initialized causing problems when using iconv Issue #1528 has been updated by Hans de Graaff. If I am reading the setlocale man page correctly, then setlocale(LC_CTYPE, "") does not change the locale environment variables at all. Instead it uses the environment variables such as LC_ALL and its specializations to initialize the locale of the application. Quoting from the man page: " If locale is "", each part of the locale that should be modified is set according to the environment variables.". The man page also mentions: On startup of the main program, the portable "C" locale is selected as default. A program may be made portable to all locales by calling: setlocale(LC_ALL, ""); after program initialization, by using the values returned from a localeconv(3) call for locale-dependent information, by using the multi-byte and wide character functions for text processing if MB_CUR_MAX > 1, and by using strcoll(3), wcscoll(3) or strxfrm(3), wcsxfrm(3) to compare strings. So it seems to me that without an explicit setlocale call it will be a matter of luck as to whether any of the other methods are actually called. Setting the locale information for the application to that of the environment consistenly seems like a good thing to have. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1528 ---------------------------------------- http://redmine.ruby-lang.org