Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.porting > #53

Re: Problem: error in iconv_open

From KO Myung-Hun <komh@chollian.net>
Newsgroups comp.os.os2.programmer.porting
Subject Re: Problem: error in iconv_open
Date 2011-06-06 22:50 +0900
Organization hanarotelecom
Message-ID <isilvu$ck7$1@tnews.hananet.net> (permalink)
References <0KhBVN5juOdd-pn2-Od3ScT2CWGXd@neo_iii>

Show all headers | View raw


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

Back to comp.os.os2.programmer.porting | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-06-05 20:22 +0000
  Re: Problem: error in iconv_open Dave Yeo <dave.r.yeo@gmail.com> - 2011-06-05 15:16 -0700
  Re: Problem: error in iconv_open KO Myung-Hun <komh@chollian.net> - 2011-06-06 22:50 +0900
    Re: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-06-06 20:40 +0000
    Re: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-06-06 20:45 +0000
      Re: Problem: error in iconv_open Dave Yeo <dave.r.yeo@gmail.com> - 2011-06-06 16:41 -0700
        Re: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-06-19 16:40 +0000
          Re: Problem: error in iconv_open Dave Yeo <dave.r.yeo@gmail.com> - 2011-06-19 11:30 -0700
            Re: Problem: error in iconv_open Ilya Zakharevich <nospam-abuse@ilyaz.org> - 2011-06-22 21:56 +0000
              Re: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-07-09 10:37 +0000
                Re: SOLVED!: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-07-10 18:24 +0000
                Re: SOLVED!: Problem: error in iconv_open "Lars Erdmann" <lars.erdmann@arcor.de> - 2011-07-10 20:41 +0200
                Re: SOLVED!: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-07-10 22:33 +0000
                Re: SOLVED!: Problem: error in iconv_open vsvidya7@gmail.com - 2013-01-21 03:00 -0800
                Re: SOLVED!: Problem: error in iconv_open Dave Yeo <dave.r.yeo@gmail.com> - 2011-07-10 12:07 -0700
      Re: Problem: error in iconv_open Ilya Zakharevich <nospam-abuse@ilyaz.org> - 2011-06-08 00:45 +0000
        Re: Problem: error in iconv_open "Mentore Siesto" <mentoreshoryu@fattimiei.zx> - 2011-06-08 20:49 +0000
        Re: Problem: error in iconv_open piesse <piesse@despammed.com> - 2011-06-09 22:28 +0200
          Re: Problem: error in iconv_open Mentore <mentore.siesto@libero.it> - 2011-06-13 03:33 -0700

csiph-web