summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-05-23 19:41:36 +0000
committerBruno Haible <bruno@clisp.org>2001-05-23 19:41:36 +0000
commit735eef15ed39cf7227c825b4608debe069c6a679 (patch)
tree278e63e448a7c59cadf37b6a8e73c7016b7f9bb4
parent276d900cda93edcccad69797892400c43b4ba865 (diff)
downloadexternal_gettext-735eef15ed39cf7227c825b4608debe069c6a679.zip
external_gettext-735eef15ed39cf7227c825b4608debe069c6a679.tar.gz
external_gettext-735eef15ed39cf7227c825b4608debe069c6a679.tar.bz2
Avoid crash on EUC-KR PO files.
-rw-r--r--lib/ChangeLog6
-rw-r--r--lib/linebreak.c18
-rw-r--r--src/ChangeLog4
-rw-r--r--src/write-po.c6
4 files changed, 32 insertions, 2 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index d592dae..a2ad0b7 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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.
diff --git a/lib/linebreak.c b/lib/linebreak.c
index 164f730..e3bacae 100644
--- a/lib/linebreak.c
+++ b/lib/linebreak.c
@@ -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. */
diff --git a/src/ChangeLog b/src/ChangeLog
index 06d521b..c047bda 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/write-po.c b/src/write-po.c
index 0f65809..1479b36 100644
--- a/src/write-po.c
+++ b/src/write-po.c
@@ -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