On Wed, Apr 02, 2008 at 04:18:06PM -0700, Adam Klein wrote:
> support), I get the following error:
>
> ---> LANG
> <--- 200 default language set (EN)
> iconv_open(UTF-8,) failed: Invalid argument
> iconv_open(//TRANSLIT,UTF-8) failed: Invalid argument
>
> I built lftp on a Solaris 9 system, using gcc 3.3, with libiconv-1.11
For some reason lftp cannot determine local character set (using
nl_langinfo(CODESET)).
Try to add `set file:charset YOUR-CHARSET' to ~/.lftp/rc or /etc/lftp.conf
To suppress this error message, use attached patch.
--
Alexander.
Index: buffer.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/buffer.cc,v
retrieving revision 1.68
diff -u -p -r1.68 buffer.cc
--- buffer.cc 21 Jan 2008 14:07:01 -0000 1.68
+++ buffer.cc 3 Apr 2008 05:42:56 -0000
@@ -325,9 +325,11 @@ DataRecoder::DataRecoder(const char *fro
void DirectedBuffer::SetTranslation(const char *enc,bool translit)
{
- if(!enc)
+ if(!enc || !*enc)
return;
const char *local_code=ResMgr::Query("file:charset",0);
+ if(!local_code || !*local_code)
+ return;
const char *from_code=(mode==GET?enc:local_code);
const char *to_code =(mode==GET?local_code:enc);
SetTranslator(new DataRecoder(from_code,to_code,translit));
Index: resource.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/resource.cc,v
retrieving revision 1.152
diff -u -p -r1.152 resource.cc
--- resource.cc 14 Mar 2008 15:46:29 -0000 1.152
+++ resource.cc 3 Apr 2008 05:39:20 -0000
@@ -425,7 +425,7 @@ void ResMgr::ClassInit()
#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
char *cs=nl_langinfo(CODESET);
- if(cs)
+ if(cs && cs[0])
Set("file:charset",0,cs);
#endif