summaryrefslogtreecommitdiff
path: root/source4/lib/charcnv.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-19 10:15:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:01:55 -0500
commit343545a8836d1665bb3c41974d743b03fd0b6446 (patch)
tree53cea3d7ab63713c2c0e48e0959ef0d7fe444117 /source4/lib/charcnv.c
parent904f20a9fba420e16fe3c281ca60a9189327334d (diff)
downloadsamba-343545a8836d1665bb3c41974d743b03fd0b6446.tar.gz
samba-343545a8836d1665bb3c41974d743b03fd0b6446.tar.bz2
samba-343545a8836d1665bb3c41974d743b03fd0b6446.zip
r3063: our default dos charset is CP850, but some systems don't have that, so
as a special case, automatically fall back to ASCII if its not found. (This used to be commit 55aeb33343180929fbd7b3568b058b506aee7540)
Diffstat (limited to 'source4/lib/charcnv.c')
-rw-r--r--source4/lib/charcnv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/lib/charcnv.c b/source4/lib/charcnv.c
index 40e68df984..3c27d59664 100644
--- a/source4/lib/charcnv.c
+++ b/source4/lib/charcnv.c
@@ -98,6 +98,20 @@ static smb_iconv_t get_conv_handle(charset_t from, charset_t to)
n2 = charset_name(to);
conv_handles[from][to] = smb_iconv_open(n2,n1);
+
+ if (conv_handles[from][to] == (smb_iconv_t)-1) {
+ if ((from == CH_DOS || to == CH_DOS) &&
+ strcasecmp(charset_name(CH_DOS), "ASCII") != 0) {
+ DEBUG(0,("dos charset '%s' unavailable - using ASCII\n",
+ charset_name(CH_DOS)));
+ lp_set_cmdline("dos charset", "ASCII");
+
+ n1 = charset_name(from);
+ n2 = charset_name(to);
+
+ conv_handles[from][to] = smb_iconv_open(n2,n1);
+ }
+ }
return conv_handles[from][to];
}