bug-gnulib
[Top][All Lists]
Advanced

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

update localcharset module


From: Bruno Haible
Subject: update localcharset module
Date: Sat, 22 Jul 2006 16:09:39 +0200
User-agent: KMail/1.9.1

Merge from gettext.

2006-06-17  Bruno Haible  <address@hidden>

        * config.charset: Update for NetBSD 3.0.

2006-05-17  Bruno Haible  <address@hidden>

        Cygwin portability.
        * localcharset.c (WIN32_NATIVE): Renamed from WIN32.

2006-05-16  Bruno Haible  <address@hidden>

        * localcharset.c [CYGWIN]: Include <windows.h>.
        (get_charset_aliases): For Cygwin, return the same CPxxx aliases list
        as under WIN32.
        (locale_charset) [CYGWIN]: Try to retrieve the encoding from the
        environment variables. Fall back to GetACP().

2006-04-05  Bruno Haible  <address@hidden>

        * config.charset: Update Juan Manuel Guerrero's address.

*** config.charset      14 May 2005 06:03:57 -0000      1.22
--- config.charset      22 Jul 2006 14:08:34 -0000
***************
*** 1,7 ****
  #! /bin/sh
  # Output a system dependent table of character encoding aliases.
  #
! #   Copyright (C) 2000-2004 Free Software Foundation, Inc.
  #
  #   This program is free software; you can redistribute it and/or modify
  #   it under the terms of the GNU General Public License as published by
--- 1,7 ----
  #! /bin/sh
  # Output a system dependent table of character encoding aliases.
  #
! #   Copyright (C) 2000-2004, 2006 Free Software Foundation, Inc.
  #
  #   This program is free software; you can redistribute it and/or modify
  #   it under the terms of the GNU General Public License as published by
***************
*** 30,50 ****
  # The current list of GNU canonical charset names is as follows.
  #
  #       name              MIME?             used by which systems
! #   ASCII, ANSI_X3.4-1968       glibc solaris freebsd darwin
! #   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd darwin
! #   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd darwin
  #   ISO-8859-3              Y   glibc solaris
! #   ISO-8859-4              Y   osf solaris freebsd darwin
! #   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd darwin
  #   ISO-8859-6              Y   glibc aix hpux solaris
! #   ISO-8859-7              Y   glibc aix hpux irix osf solaris darwin
  #   ISO-8859-8              Y   glibc aix hpux osf solaris
  #   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin
! #   ISO-8859-13                 glibc darwin
  #   ISO-8859-14                 glibc
  #   ISO-8859-15                 glibc aix osf solaris freebsd darwin
! #   KOI8-R                  Y   glibc solaris freebsd darwin
! #   KOI8-U                  Y   glibc freebsd darwin
  #   KOI8-T                      glibc
  #   CP437                       dos
  #   CP775                       dos
--- 30,50 ----
  # The current list of GNU canonical charset names is as follows.
  #
  #       name              MIME?             used by which systems
! #   ASCII, ANSI_X3.4-1968       glibc solaris freebsd netbsd darwin
! #   ISO-8859-1              Y   glibc aix hpux irix osf solaris freebsd 
netbsd darwin
! #   ISO-8859-2              Y   glibc aix hpux irix osf solaris freebsd 
netbsd darwin
  #   ISO-8859-3              Y   glibc solaris
! #   ISO-8859-4              Y   osf solaris freebsd netbsd darwin
! #   ISO-8859-5              Y   glibc aix hpux irix osf solaris freebsd 
netbsd darwin
  #   ISO-8859-6              Y   glibc aix hpux solaris
! #   ISO-8859-7              Y   glibc aix hpux irix osf solaris netbsd darwin
  #   ISO-8859-8              Y   glibc aix hpux osf solaris
  #   ISO-8859-9              Y   glibc aix hpux irix osf solaris darwin
! #   ISO-8859-13                 glibc netbsd darwin
  #   ISO-8859-14                 glibc
  #   ISO-8859-15                 glibc aix osf solaris freebsd darwin
! #   KOI8-R                  Y   glibc solaris freebsd netbsd darwin
! #   KOI8-U                  Y   glibc freebsd netbsd darwin
  #   KOI8-T                      glibc
  #   CP437                       dos
  #   CP775                       dos
***************
*** 57,63 ****
  #   CP862                       dos
  #   CP864                       dos
  #   CP865                       dos
! #   CP866                       freebsd darwin dos
  #   CP869                       dos
  #   CP874                       woe32 dos
  #   CP922                       aix
--- 57,63 ----
  #   CP862                       dos
  #   CP864                       dos
  #   CP865                       dos
! #   CP866                       freebsd netbsd darwin dos
  #   CP869                       dos
  #   CP874                       woe32 dos
  #   CP922                       aix
***************
*** 70,91 ****
  #   CP1125                      dos
  #   CP1129                      aix
  #   CP1250                      woe32
! #   CP1251                      glibc solaris darwin woe32
  #   CP1252                      aix woe32
  #   CP1253                      woe32
  #   CP1254                      woe32
  #   CP1255                      glibc woe32
  #   CP1256                      woe32
  #   CP1257                      woe32
! #   GB2312                  Y   glibc aix hpux irix solaris freebsd darwin
! #   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd darwin
! #   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd darwin
! #   EUC-TW                      glibc aix hpux irix osf solaris
! #   BIG5                    Y   glibc aix hpux osf solaris freebsd darwin
  #   BIG5-HKSCS                  glibc solaris
  #   GBK                         glibc aix osf solaris woe32 dos
! #   GB18030                     glibc solaris
! #   SHIFT_JIS               Y   hpux osf solaris freebsd darwin
  #   JOHAB                       glibc solaris woe32
  #   TIS-620                     glibc aix hpux osf solaris
  #   VISCII                  Y   glibc
--- 70,91 ----
  #   CP1125                      dos
  #   CP1129                      aix
  #   CP1250                      woe32
! #   CP1251                      glibc solaris netbsd darwin woe32
  #   CP1252                      aix woe32
  #   CP1253                      woe32
  #   CP1254                      woe32
  #   CP1255                      glibc woe32
  #   CP1256                      woe32
  #   CP1257                      woe32
! #   GB2312                  Y   glibc aix hpux irix solaris freebsd netbsd 
darwin
! #   EUC-JP                  Y   glibc aix hpux irix osf solaris freebsd 
netbsd darwin
! #   EUC-KR                  Y   glibc aix hpux irix osf solaris freebsd 
netbsd darwin
! #   EUC-TW                      glibc aix hpux irix osf solaris netbsd
! #   BIG5                    Y   glibc aix hpux osf solaris freebsd netbsd 
darwin
  #   BIG5-HKSCS                  glibc solaris
  #   GBK                         glibc aix osf solaris woe32 dos
! #   GB18030                     glibc solaris netbsd
! #   SHIFT_JIS               Y   hpux osf solaris freebsd netbsd darwin
  #   JOHAB                       glibc solaris woe32
  #   TIS-620                     glibc aix hpux osf solaris
  #   VISCII                  Y   glibc
***************
*** 99,105 ****
  #   HP-KANA8                    hpux
  #   DEC-KANJI                   osf
  #   DEC-HANYU                   osf
! #   UTF-8                   Y   glibc aix hpux osf solaris darwin
  #
  # Note: Names which are not marked as being a MIME name should not be used in
  # Internet protocols for information interchange (mail, news, etc.).
--- 99,105 ----
  #   HP-KANA8                    hpux
  #   DEC-KANJI                   osf
  #   DEC-HANYU                   osf
! #   UTF-8                   Y   glibc aix hpux osf solaris netbsd darwin
  #
  # Note: Names which are not marked as being a MIME name should not be used in
  # Internet protocols for information interchange (mail, news, etc.).
***************
*** 387,392 ****
--- 387,394 ----
        echo "ISO8859-2 ISO-8859-2"
        echo "ISO8859-4 ISO-8859-4"
        echo "ISO8859-5 ISO-8859-5"
+       echo "ISO8859-7 ISO-8859-7"
+       echo "ISO8859-13 ISO-8859-13"
        echo "ISO8859-15 ISO-8859-15"
        echo "eucCN GB2312"
        echo "eucJP EUC-JP"
***************
*** 479,485 ****
        echo "# If you find that the encoding given for your language and"
        echo "# country is not the one your DOS machine actually uses, just"
        echo "# correct it in this file, and send a mail to"
!       echo "# Juan Manuel Guerrero <address@hidden>"
        echo "# and Bruno Haible <address@hidden>."
        echo "#"
        echo "C ASCII"
--- 481,487 ----
        echo "# If you find that the encoding given for your language and"
        echo "# country is not the one your DOS machine actually uses, just"
        echo "# correct it in this file, and send a mail to"
!       echo "# Juan Manuel Guerrero <address@hidden>"
        echo "# and Bruno Haible <address@hidden>."
        echo "#"
        echo "C ASCII"
*** localcharset.c      10 Jan 2006 13:52:11 -0000      1.21
--- localcharset.c      22 Jul 2006 14:08:34 -0000
***************
*** 40,47 ****
  #endif
  
  #if defined _WIN32 || defined __WIN32__
! # undef WIN32   /* avoid warning on mingw32 */
! # define WIN32
  #endif
  
  #if defined __EMX__
--- 40,46 ----
  #endif
  
  #if defined _WIN32 || defined __WIN32__
! # define WIN32_NATIVE
  #endif
  
  #if defined __EMX__
***************
*** 49,55 ****
  # define OS2
  #endif
  
! #if !defined WIN32
  # if HAVE_LANGINFO_CODESET
  #  include <langinfo.h>
  # else
--- 48,54 ----
  # define OS2
  #endif
  
! #if !defined WIN32_NATIVE
  # if HAVE_LANGINFO_CODESET
  #  include <langinfo.h>
  # else
***************
*** 57,63 ****
  #   include <locale.h>
  #  endif
  # endif
! #elif defined WIN32
  # define WIN32_LEAN_AND_MEAN
  # include <windows.h>
  #endif
--- 56,66 ----
  #   include <locale.h>
  #  endif
  # endif
! # ifdef __CYGWIN__
! #  define WIN32_LEAN_AND_MEAN
! #  include <windows.h>
! # endif
! #elif defined WIN32_NATIVE
  # define WIN32_LEAN_AND_MEAN
  # include <windows.h>
  #endif
***************
*** 113,119 ****
    cp = charset_aliases;
    if (cp == NULL)
      {
! #if !(defined VMS || defined WIN32)
        FILE *fp;
        const char *dir;
        const char *base = "charset.alias";
--- 116,122 ----
    cp = charset_aliases;
    if (cp == NULL)
      {
! #if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
        FILE *fp;
        const char *dir;
        const char *base = "charset.alias";
***************
*** 239,245 ****
           "DECKOREAN" "\0" "EUC-KR" "\0";
  # endif
  
! # if defined WIN32
        /* To avoid the troubles of installing a separate file in the same
         directory as the DLL and of retrieving the DLL's directory at
         runtime, simply inline the aliases here.  */
--- 242,248 ----
           "DECKOREAN" "\0" "EUC-KR" "\0";
  # endif
  
! # if defined WIN32_NATIVE || defined __CYGWIN__
        /* To avoid the troubles of installing a separate file in the same
         directory as the DLL and of retrieving the DLL's directory at
         runtime, simply inline the aliases here.  */
***************
*** 291,303 ****
    const char *codeset;
    const char *aliases;
  
! #if !(defined WIN32 || defined OS2)
  
  # if HAVE_LANGINFO_CODESET
  
    /* Most systems support nl_langinfo (CODESET) nowadays.  */
    codeset = nl_langinfo (CODESET);
  
  # else
  
    /* On old systems which lack it, use setlocale or getenv.  */
--- 294,353 ----
    const char *codeset;
    const char *aliases;
  
! #if !(defined WIN32_NATIVE || defined OS2)
  
  # if HAVE_LANGINFO_CODESET
  
    /* Most systems support nl_langinfo (CODESET) nowadays.  */
    codeset = nl_langinfo (CODESET);
  
+ #  ifdef __CYGWIN__
+   /* Cygwin 2006 does not have locales.  nl_langinfo (CODESET) always
+      returns "US-ASCII".  As long as this is not fixed, return the suffix
+      of the locale name from the environment variables (if present) or
+      the codepage as a number.  */
+   if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
+     {
+       const char *locale;
+       static char buf[2 + 10 + 1];
+ 
+       locale = getenv ("LC_ALL");
+       if (locale == NULL || locale[0] == '\0')
+       {
+         locale = getenv ("LC_CTYPE");
+         if (locale == NULL || locale[0] == '\0')
+           locale = getenv ("LANG");
+       }
+       if (locale != NULL && locale[0] != '\0')
+       {
+         /* If the locale name contains an encoding after the dot, return
+            it.  */
+         const char *dot = strchr (locale, '.');
+ 
+         if (dot != NULL)
+           {
+             const char *modifier;
+ 
+             dot++;
+             /* Look for the possible @... trailer and remove it, if any.  */
+             modifier = strchr (dot, '@');
+             if (modifier == NULL)
+               return dot;
+             if (modifier - dot < sizeof (buf))
+               {
+                 memcpy (buf, dot, modifier - dot);
+                 buf [modifier - dot] = '\0';
+                 return buf;
+               }
+           }
+       }
+ 
+       /* Woe32 has a function returning the locale's codepage as a number.  */
+       sprintf (buf, "CP%u", GetACP ());
+       codeset = buf;
+     }
+ #  endif
+ 
  # else
  
    /* On old systems which lack it, use setlocale or getenv.  */
***************
*** 328,334 ****
  
  # endif
  
! #elif defined WIN32
  
    static char buf[2 + 10 + 1];
  
--- 378,384 ----
  
  # endif
  
! #elif defined WIN32_NATIVE
  
    static char buf[2 + 10 + 1];
  




reply via email to

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