bug-gettext
[Top][All Lists]
Advanced

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

Re: Re: msgfmt: Cannot convert from "ASCII" to "UTF-8" on gettext-22.x (


From: alphons
Subject: Re: Re: msgfmt: Cannot convert from "ASCII" to "UTF-8" on gettext-22.x (gettext-21.1 no problem)
Date: Fri, 22 Sep 2023 17:01:03 +0200

>There is a change in the way msgfmt works, in 0.22. It is mentioned in the NEWS
>file. It requires a working iconv() now.

100%.

>> The used glibc-2.38 (of the host system) is compiled default, and supports 
>> iconv

>   checking for iconv.h
>   checking for iconv
>   checking for working iconv
>
>This will help you understand why, in your installation, glibc's iconv() does 
>not work.

The ./configure output of gettext-0.22.2 resulting in:

checking for iconv.h... yes
...
checking for iconv... yes
checking for working iconv... no
checking whether iconv is compatible with its POSIX signature... yes

So lets do some diag on the build system:

$ ldd --version
ldd (GNU libc) 2.38

$ nm -D /usr/lib/libc.so.6 | grep iconv
0000000000028120 T iconv@@GLIBC_2.2.5
00000000000282e0 T iconv_close@@GLIBC_2.2.5
0000000000028080 T iconv_open@@GLIBC_2.2.5

$ iconv -l

The following list contains all the coded character sets known.  This does
not necessarily mean that all combinations of these names can be used for
the FROM and TO command line parameters.  One coded character set can be
listed with several different names (aliases).

  8859_1, 10646-1:1993, 10646-1:1993/UCS4, ANSI_X3.4-1968, ANSI_X3.4-1986,
  ANSI_X3.4, ANSI_X3.110-1983, ANSI_X3.110, ASCII, CP367, CP819, CP1252,
  CSASCII, CSA_T500-1983, CSA_T500, CSISO99NAPLPS, CSISOLATIN1, CSUCS4,
  CSUNICODE, IBM367, IBM819, ISO-8859-1, ISO-8859-15, ISO-10646,
  ISO-10646/UCS2, ISO-10646/UCS4, ISO-10646/UTF-8, ISO-10646/UTF8, ISO-IR-6,
  ISO-IR-99, ISO-IR-100, ISO-IR-193, ISO-IR-203, ISO646-US, ISO8859-1,
  ISO8859-15, ISO88591, ISO885915, ISO_646.IRV:1991, ISO_8859-1,
  ISO_8859-1:1987, ISO_8859-15, ISO_8859-15:1998, L1, LATIN-9, LATIN1, LATIN9,
  MS-ANSI, NAPLPS, OSF00010001, OSF00010020, OSF00010100, OSF00010101,
  OSF00010102, OSF00010104, OSF00010105, OSF00010106, OSF05010001, UCS-2,
  UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UCS2, UCS4, UNICODE, UNICODEBIG,
  UNICODELITTLE, US-ASCII, US, UTF-7-IMAP, UTF-7, UTF-8, UTF-16, UTF-16BE,
  UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF7, UTF8, UTF16, UTF16BE, UTF16LE,
  UTF32, UTF32BE, UTF32LE, WCHAR_T, WINDOWS-1252

Okay, check if glibc has a working iconv() by this simple test program
converting some ISO88591 string to a UTF-8 string (ASCII to UTF-8 also works):
--
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iconv.h>

#define ICONV_CONST

int main()
{
  iconv_t cd = iconv_open("UTF8", "ISO88591");

  if(cd != (iconv_t)(-1))
  {
    static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen";
    ICONV_CONST char *inptr = input;
    size_t inbytesleft = strlen (input);

    char output[255];
    char *outptr = output;
    size_t outbytesleft = sizeof (output);

    size_t res = iconv (cd,
       &inptr, &inbytesleft,
       &outptr, &outbytesleft);
    iconv_close(cd);

    if (res != 0)
      printf("working iconv()... no\n");
    else
      printf("iconv() [%.*s]\n", (255-outbytesleft), output);
   }
  else
  {
    printf("error\n");
  }
}
--
$ gcc iconv.c -o iconv
$ ./iconv
iconv() [Ärger mit bösen Bübchen]

That looks alright, so this glibc-2.38 has actually a working iconv().
So, question arises why does ./configuration not detect a working iconv() .... ?

I am using LC_ALL=POSIX not LC_ALL=C are the checks correct?

thanks for the help, i will figure this out (eventually) ;-)

-Alphons.





reply via email to

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