bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iconv test on AIX 7.1BETA


From: Bruno Haible
Subject: Re: iconv test on AIX 7.1BETA
Date: Sat, 31 Jul 2010 12:30:06 +0200
User-agent: KMail/1.9.9

Rainer Tammer wrote:
> AIX 6.1 Technology Level 4:
> 
> # xlc testme.c -liconv
> # ./a.out
> res = 0
> 
> AIX 7.1BETA
> 
> # ./a.out
> res = 0

Thanks. This is surprising. I'm not sure I fully understand what happens. Can
you run this slightly extended test program as well, please?

===============================================================================
#include <iconv.h>
#include <errno.h>
#include <stdio.h>

int main ()
{
  iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
  if (cd_88591_to_utf8 == (iconv_t)(-1)) return 1;
  {
    static const char input[] = "\304";
    static char buf[2] = { (char)0xDE, (char)0xAD };
    const char *inptr = input;
    size_t inbytesleft = 1;
    char *outptr = buf;
    size_t outbytesleft = 1;
    size_t res = iconv (cd_88591_to_utf8,
                        (char **) &inptr, &inbytesleft,
                        &outptr, &outbytesleft);
    if (res == (size_t)(-1))
      {
        int err = errno;
        fprintf (stderr, "errno = %d\n", err);
        errno = err;
        perror ("");
      }
    else
      {
        printf ("res = %lu\n", (unsigned long) res);
        printf ("outptr-buf = %d, outbytesleft = %d, buf = { 0x%02X, 0x%02X 
}\n",
                (int)(outptr-buf), (int) outbytesleft, (unsigned char) buf[0], 
(unsigned char) buf[1]);
      }
    return 0;
  }
}
===============================================================================

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]