]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Avoid crash on EUC-KR PO files.
authorBruno Haible <bruno@clisp.org>
Wed, 23 May 2001 19:41:36 +0000 (19:41 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 23 May 2001 19:41:36 +0000 (19:41 +0000)
lib/ChangeLog
lib/linebreak.c
src/ChangeLog
src/write-po.c

index d592daeecf042f563576baa4622fca303385c3c0..a2ad0b7822ad0ad064604633832a539e77f1dbe5 100644 (file)
@@ -1,3 +1,9 @@
+2001-05-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * linebreak.c (mbs_possible_linebreaks): Avoid broken EUC-KR
+       conversion in glibc-2.1.
+       (mbs_width_linebreaks): Likewise.
+
 2001-05-15  Bruno Haible  <haible@clisp.cons.org>
 
        * progname.h (set_program_name): New declaration.
index 164f730fdbcf35c18efc2729c3ff8fc114252ab3..e3bacae29d38b78b251a394debf3ace9ca90175e 100644 (file)
@@ -1711,7 +1711,14 @@ mbs_possible_linebreaks (s, n, encoding, p)
   else
     {
 #if HAVE_ICONV
-      iconv_t to_utf8 = iconv_open (UTF8_NAME, encoding);
+      iconv_t to_utf8;
+      /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+      if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
+       to_utf8 = (iconv_t)(-1);
+      else
+# endif
+      to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
         {
           /* Determine the length of the resulting UTF-8 string.  */
@@ -1790,7 +1797,14 @@ mbs_width_linebreaks (s, n, width, start_column, at_end_columns, o, encoding, p)
   else
     {
 #if HAVE_ICONV
-      iconv_t to_utf8 = iconv_open (UTF8_NAME, encoding);
+      iconv_t to_utf8;
+      /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+      if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0))
+       to_utf8 = (iconv_t)(-1);
+      else
+# endif
+      to_utf8 = iconv_open (UTF8_NAME, encoding);
       if (to_utf8 != (iconv_t)(-1))
         {
           /* Determine the length of the resulting UTF-8 string.  */
index 06d521b23e8814d4b463fef508742c4fba097db1..c047bdab11ee8fe5e02dfcb378ed9af68272a441 100644 (file)
@@ -1,3 +1,7 @@
+2001-05-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * write-po.c (wrap): Avoid broken EUC-KR conversion in glibc-2.1.
+
 2001-05-21  Bruno Haible  <haible@clisp.cons.org>
 
        * xgettext.c (construct_header): Replace 8-bit with 8bit.
index 0f65809d0ead114266f91e6557f347fe2cd209c8..1479b361b268b4453e63ab9fbade3d986affce4a 100644 (file)
@@ -211,6 +211,12 @@ wrap (fp, line_prefix, name, value, do_wrap, charset)
     /* Write a PO file in old format, with extraneous backslashes.  */
     conv = (iconv_t)(-1);
   else
+    /* Avoid glibc-2.1 bug with EUC-KR.  */
+# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION
+    if (strcmp (charset, "EUC-KR") == 0)
+      conv = (iconv_t)(-1);
+    else
+# endif
     /* Use iconv() to parse multibyte characters.  */
     conv = iconv_open ("UTF-8", charset);
 #endif