diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-06-30 02:11:13 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-06-30 02:11:13 +0000 |
commit | 0a4959d48d62cd97d912182f99e0ea969d48253f (patch) | |
tree | 4d94514e2403709280096934f5ae58aeeab15e1b /source3/lib | |
parent | b8723aaa65a2bd760d6d2d9c9409f7c39867484c (diff) | |
download | samba-0a4959d48d62cd97d912182f99e0ea969d48253f.tar.gz samba-0a4959d48d62cd97d912182f99e0ea969d48253f.tar.bz2 samba-0a4959d48d62cd97d912182f99e0ea969d48253f.zip |
- added LOCALE patch from vorlon@debian.org (Steve Langasek) (bug #122)
- changed --enable-developer debug to use -gstabs as it makes the
samba binaries about 10x smaller and is still quite functional for
samba debugging
(This used to be commit 53bfcd478a193d4def8da872e92d7ed8f46aa4b9)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/charcnv.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 708ef343e1..55cf73d2b1 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -55,6 +55,30 @@ static const char *charset_name(charset_t ch) else if (ch == CH_DISPLAY) ret = lp_display_charset(); else if (ch == CH_UTF8) ret = "UTF8"; +#if defined(HAVE_NL_LANGINFO) && defined(CODESET) + if (ret && strcasecmp(ret, "LOCALE") == 0) { + const char *ln = NULL; + +#ifdef HAVE_SETLOCALE + setlocale(LC_ALL, ""); +#endif + ln = nl_langinfo(CODESET); + if (ln) { + /* Check whether the charset name is supported + by iconv */ + smb_iconv_t handle = smb_iconv_open(ln,"UCS-2LE"); + if (handle == (smb_iconv_t) -1) { + DEBUG(5,("Locale charset '%s' unsupported, using ASCII instead\n", ln)); + ln = NULL; + } else { + DEBUG(5,("Substituting charset '%s' for LOCALE\n", ln)); + smb_iconv_close(handle); + } + } + ret = ln; + } +#endif + if (!ret || !*ret) ret = "ASCII"; return ret; } |