From 8cd67d76683a41a1db5efc3a9c65e056ec2263f4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Jun 2003 02:22:52 +0000 Subject: reverted locale patch put in by jht (originally from vorlon). There are lots of things wrong with this patch, including: 1) it overrides a user chosen configuration option 2) it adds lots of complexity inside a loop when a tiny piece of code outside the loop would do the same thing 3) it does no error checking, and is sure to crash on some systems If you want this functionality then try something like this at the end of charset_name(): #ifdef HAVE_NL_LANGINFO if (strcasecmp(ret, "LOCALE") == 0) { const char *ln = nl_langinfo(CODESET); if (ln) { DEBUG(5,("Substituting charset '%s' for LOCALE\n", ln)); return ln; } } #endif then users can set 'display charset = LOCALE' to get the locale based charset. You could even make that the default for systems that have nl_langinfo(). (This used to be commit 382b9b806b1ecd227b1ea247e3825d6848090462) --- source3/lib/charcnv.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'source3/lib/charcnv.c') diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index b37f468134..708ef343e1 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -90,28 +90,10 @@ void init_iconv(void) if (!conv_handles[CH_UCS2][CH_UNIX]) conv_handles[CH_UCS2][CH_UNIX] = smb_iconv_open("ASCII", "UCS-2LE"); -#ifdef HAVE_SETLOCALE - setlocale(LC_ALL, ""); -#endif - for (c1=0;c1from_name) == 0 && - strcmp(n2, conv_handles[c1][c2]->to_name) == 0) - continue; - - if (c2==CH_DISPLAY && conv_handles[c1][c2] && - strcmp(n1, conv_handles[c1][c2]->from_name) == 0 && - strcmp(ln, conv_handles[c1][c2]->to_name) == 0) - continue; - -#endif if (conv_handles[c1][c2] && strcmp(n1, conv_handles[c1][c2]->from_name) == 0 && strcmp(n2, conv_handles[c1][c2]->to_name) == 0) @@ -122,25 +104,6 @@ void init_iconv(void) if (conv_handles[c1][c2]) smb_iconv_close(conv_handles[c1][c2]); -#ifdef HAVE_NL_LANGINFO - if (c1==CH_DISPLAY && c2==CH_DISPLAY) { - conv_handles[c1][c2] = smb_iconv_open(ln,ln); - if (conv_handles[c1][c2] != (smb_iconv_t)-1) { - continue; - } - } else if (c1==CH_DISPLAY) { - conv_handles[c1][c2] = smb_iconv_open(n2,ln); - if (conv_handles[c1][c2] != (smb_iconv_t)-1) { - continue; - } - } else if (c2==CH_DISPLAY) { - conv_handles[c1][c2] = smb_iconv_open(ln,n1); - if (conv_handles[c1][c2] != (smb_iconv_t)-1) { - continue; - } - } - /* Fall back to the configured charset. */ -#endif conv_handles[c1][c2] = smb_iconv_open(n2,n1); if (conv_handles[c1][c2] == (smb_iconv_t)-1) { DEBUG(0,("Conversion from %s to %s not supported\n", -- cgit