Internal implementation is smaller.
config FEATURE_CHECK_UNICODE_IN_ENV
- bool "Check $LANG environment variable"
+ bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables"
default n
depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
help
With this option on, Unicode support is activated
- only if LANG variable has the value of the form "xxxx.utf8"
+ only if locale-related variables have the value of the form
+ "xxxx.utf8"
Otherwise, Unicode support will be always enabled and active.
void FAST_FUNC init_unicode(void)
{
+ /* Some people set only $LC_CTYPE, not $LC_ALL, because they want
+ * only Unicode to be activated on their system, not the whole
+ * shebang of wrong decimal points, strange date formats and so on.
+ *
+ * TODO? Maybe we should use LC_CTYPE instead of LC_ALL in setlocale()?
+ */
if (unicode_status == UNICODE_UNKNOWN) {
char *s = getenv("LC_ALL");
+ if (!s) s = getenv("LC_CTYPE");
if (!s) s = getenv("LANG");
reinit_unicode(s);
}
{
if (unicode_status == UNICODE_UNKNOWN) {
char *s = getenv("LC_ALL");
+ if (!s) s = getenv("LC_CTYPE");
if (!s) s = getenv("LANG");
reinit_unicode(s);
}
*/
{
const char *s = lookupvar("LC_ALL");
+ if (!s) s = lookupvar("LC_CTYPE");
if (!s) s = lookupvar("LANG");
reinit_unicode(s);
}
* shell was started. Therefore, re-check LANG every time:
*/
const char *s = get_local_var_value("LC_ALL");
+ if (!s) s = get_local_var_value("LC_CTYPE");
if (!s) s = get_local_var_value("LANG");
reinit_unicode(s);