bug in BIG5 converter

Bruno Haible haible@ilog.fr
Mon Sep 4 05:55:00 GMT 2000


The BIG5 iconv converter from Big5 to Unicode contains identity mappings
for 0x81..0xA0, 0xFA..0xFF. But the reverse direction doesn't do them, and
the charmap doesn't contain them either.

Here is a patch to remove this identity mapping.


2000-09-03  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/big5.c (BODY for FROM_LOOP): Bytes 0x81..0xA0, 0xFA..0xFF
	are invalid.

*** glibc-20000831/iconvdata/big5.c.bak	Wed Aug 30 23:43:37 2000
--- glibc-20000831/iconvdata/big5.c	Sun Sep  3 15:34:12 2000
***************
*** 8644,8651 ****
  									      \
  	inptr += 2;							      \
        }									      \
!     else								      \
        ++inptr;								      \
  									      \
      put32 (outptr, ch);							      \
      outptr += 4;							      \
--- 8644,8664 ----
  									      \
  	inptr += 2;							      \
        }									      \
!     else if (ch <= 0x80)						      \
        ++inptr;								      \
+     else								      \
+       {									      \
+ 	/* This is illegal.  */						      \
+ 	if (! ignore_errors_p ())					      \
+ 	  {								      \
+ 	    result = __GCONV_ILLEGAL_INPUT;				      \
+ 	    break;							      \
+ 	  }								      \
+ 									      \
+ 	++inptr;							      \
+ 	++*irreversible;						      \
+ 	continue;							      \
+       }									      \
  									      \
      put32 (outptr, ch);							      \
      outptr += 4;							      \


More information about the Libc-alpha mailing list