]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Work around Solaris 2.9 iconv() bug: iconv eats a byte without producing any
authorBruno Haible <bruno@clisp.org>
Fri, 10 Jan 2003 19:25:39 +0000 (19:25 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:55 +0000 (12:08 +0200)
output.

lib/ChangeLog
lib/linebreak.c
src/ChangeLog
src/po-charset.c
src/write-po.c

index 931782918d52ceecbe417d0c8fedfca8603c23c7..940df1a6e3e3c9b5bb42e53bb7d3d47641884979 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-10  Bruno Haible  <bruno@clisp.org>
+
+       * linebreak.c (mbs_possible_linebreaks, mbs_width_linebreaks):
+       Work around Solaris 2.9 iconv() bug.
+
 2003-01-08  Bruno Haible  <bruno@clisp.org>
 
        * safe-read.h: Update from current gnulib version.
index 200272e8810731cccf74e37f172ff44844de05f6..42d0ea10b7ec0d8093c834895efa7311e476db80 100644 (file)
@@ -1,5 +1,5 @@
 /* linebreak.c - line breaking of Unicode strings
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
 This program is free software; you can redistribute it and/or modify
@@ -1392,7 +1392,7 @@ iconv_string_length (iconv_t cd, const char *s, size_t n)
         return (size_t)(-1);
       count += outptr - tmpbuf;
     }
-  /* Avoid glibc-2.1 bug and Solaris 2.7 bug.  */
+  /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug.  */
 #if defined _LIBICONV_VERSION \
    || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
   {
@@ -1501,6 +1501,18 @@ mbs_possible_linebreaks (const char *s, size_t n, const char *encoding,
       if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
        to_utf8 = (iconv_t)(-1);
       else
+# endif
+      /* Avoid Solaris 2.9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS, GBK,
+         GB18030.  */
+# if defined __sun && !defined _LIBICONV_VERSION
+      if (   STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+          || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
+          || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
+          || STREQ (encoding, "BIG5-HKSCS", 'B', 'I', 'G', '5', '-', 'H', 'K', 'S', 'C')
+          || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
+          || STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
+        to_utf8 = (iconv_t)(-1);
+      else
 # endif
       to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
@@ -1582,6 +1594,18 @@ mbs_width_linebreaks (const char *s, size_t n,
       if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
        to_utf8 = (iconv_t)(-1);
       else
+# endif
+      /* Avoid Solaris 2.9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS, GBK,
+         GB18030.  */
+# if defined __sun && !defined _LIBICONV_VERSION
+      if (   STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+          || STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
+          || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
+          || STREQ (encoding, "BIG5-HKSCS", 'B', 'I', 'G', '5', '-', 'H', 'K', 'S', 'C')
+          || STREQ (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
+          || STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
+        to_utf8 = (iconv_t)(-1);
+      else
 # endif
       to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
index 07cce3d166bf644ad9e91b97793d6c00a2a70908..7f0c0750ddcb57277cc2b3b58fb09ae9a00b1d18 100644 (file)
@@ -1,3 +1,9 @@
+2003-01-10  Bruno Haible  <bruno@clisp.org>
+
+       * po-charset.c (po_lex_charset_set): Work around Solaris 2.9 iconv()
+       bug.
+       * write-po.c (wrap): Likewise.
+
 2003-01-08  Bruno Haible  <bruno@clisp.org>
 
        * project-id: Make it work with configure files that use
index 79cfbeea70df152f258f29550fa1f505efb52e20..e43772009cd85a9e0419faa50297e953c9458fa5 100644 (file)
@@ -1,5 +1,5 @@
 /* Charset handling while reading PO files.
-   Copyright (C) 2001-2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -262,6 +262,18 @@ Message conversion to user's charset might not work.\n"),
              if (strcmp (po_lex_charset, "EUC-KR") == 0)
                po_lex_iconv = (iconv_t)(-1);
              else
+# endif
+             /* Avoid Solaris 2.9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS,
+                GBK, GB18030.  */
+# if defined __sun && !defined _LIBICONV_VERSION
+             if (   strcmp (po_lex_charset, "GB2312") == 0
+                 || strcmp (po_lex_charset, "EUC-TW") == 0
+                 || strcmp (po_lex_charset, "BIG5") == 0
+                 || strcmp (po_lex_charset, "BIG5-HKSCS") == 0
+                 || strcmp (po_lex_charset, "GBK") == 0
+                 || strcmp (po_lex_charset, "GB18030") == 0)
+               po_lex_iconv = (iconv_t)(-1);
+             else
 # endif
              po_lex_iconv = iconv_open ("UTF-8", po_lex_charset);
              if (po_lex_iconv == (iconv_t)(-1))
index 5424661aed1cf3479ef8421e3d96097ad32dce19..5208f3bef529744c10e619cf8b8b19fec927544f 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -238,6 +238,18 @@ wrap (FILE *fp, const char *line_prefix, const char *name, const char *value,
       if (strcmp (canon_charset, "EUC-KR") == 0)
        conv = (iconv_t)(-1);
       else
+# endif
+      /* Avoid Solaris 2.9 bug with GB2312, EUC-TW, BIG5, BIG5-HKSCS, GBK,
+        GB18030.  */
+# if defined __sun && !defined _LIBICONV_VERSION
+      if (   strcmp (po_lex_charset, "GB2312") == 0
+         || strcmp (po_lex_charset, "EUC-TW") == 0
+         || strcmp (po_lex_charset, "BIG5") == 0
+         || strcmp (po_lex_charset, "BIG5-HKSCS") == 0
+         || strcmp (po_lex_charset, "GBK") == 0
+         || strcmp (po_lex_charset, "GB18030") == 0)
+       conv = (iconv_t)(-1);
+      else
 # endif
       /* Use iconv() to parse multibyte characters.  */
       conv = iconv_open ("UTF-8", canon_charset);