Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.yul.equant.net!newsfeed.dacom.co.kr!xfer1!false!feeder.kornet.net!newsfeed.hananet.net!tnews.hananet.net!not-for-mail From: KO Myung-Hun Newsgroups: comp.os.os2.programmer.porting Subject: Re: Problem: error in iconv_open Date: Mon, 06 Jun 2011 22:50:55 +0900 Organization: hanarotelecom Lines: 82 Message-ID: References: <0KhBVN5juOdd-pn2-Od3ScT2CWGXd@neo_iii> NNTP-Posting-Host: 211.211.79.186 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: tnews.hananet.net 1307368254 12935 211.211.79.186 (6 Jun 2011 13:50:54 GMT) X-Complaints-To: newsadmin@hanaro.com NNTP-Posting-Date: Mon, 6 Jun 2011 13:50:54 +0000 (UTC) User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9.1.16) Gecko/20101127 SeaMonkey/2.0.11 In-Reply-To: <0KhBVN5juOdd-pn2-Od3ScT2CWGXd@neo_iii> Xref: x330-a1.tempe.blueboxinc.net comp.os.os2.programmer.porting:53 Hi/2. Mentore Siesto wrote: > Hello all, this is a rather strange problem. > > I was asked recently to try and port AESCrypt > > http://www.aescrypt.com/linux_aes_crypt.html > > make went fine after modifying the makefile. After making the > executable file, though, testing it will always give me this: > > [U:\progetti\aescrypt305_source\src]make -f makefile.os2 testfile > ./aescrypt -e -p "praxis" test.orig.txt > Error in iconv_open: Invalid argument > make: *** [testfile] Error 255 > > Searching the password.c file (which contains iconv_open) I came > across these sentences: > > /* > * passwd_to_utf16 > * > * Convert String to UTF-16LE for windows compatibility > */ > int passwd_to_utf16(char *in_passwd, > int length, > int max_length, > char *out_passwd) > { > char *ic_outbuf, > *ic_inbuf; > iconv_t condesc; > size_t ic_inbytesleft, > ic_outbytesleft; > > ic_inbuf = in_passwd; > ic_inbytesleft = length; > ic_outbytesleft = max_length; > ic_outbuf = out_passwd; > > if ((condesc = iconv_open("UTF-16LE", nl_langinfo(CODESET))) == > (iconv_t)(-1)) > { > perror("Error in iconv_open"); > return -1; > } > > The remainder of the function calls iconv to convert the given > password and use it. > > It seems that the error is caused by the nl_langinfo(CODESET) call, > which gives (on my system) "en_US"; this seems to cause the iconv_open > error. > > Of course I tried substituting it with other ideas, like using getenv > to retrieve the locale, but still got errors. > > I tried to learn how iconv and iconv_open work, but it seems rather > confusing to me. > > Would someone of you be so kind to suggest me a way to circumvent this > problem? Having AES Crypt available would be useful. > > Thanks in advance! > Mentore If you use kLIBC, it does not support UTF-16LE encoding. Instead, use UCS-2LE. Or, if you really want to use UTF-16LE, you can use GNU libiconv as Dave Yeo said. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.11 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 1GHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr