This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in JOHAB converter



The iconv converter module for Korean JOHAB has a bug in the Unicode to JOHAB
direction. The entire series of non-Hangul KSC5601 characters is incorrectly
mapped. For example, U+3000 gets mapped to 0x4B00 instead of 0xD931. (The
values after the call to ucs4_to_ksc5601_sym are outptr[0] = outptr[1] = 0x21.)

Here is a fix.

2000-07-30  Bruno Haible  <haible@clisp.cons.org>

	* iconvdata/johab.c (BODY for TO_LOOP): After calling
	ucs4_to_ksc5601_sym, fix the conversion to JOHAB.

*** glibc-20000729/iconvdata/johab.c.bak	Mon Jul  3 16:39:27 2000
--- glibc-20000729/iconvdata/johab.c	Sun Jul 30 21:53:17 2000
***************
*** 413,418 ****
--- 413,419 ----
  	else								      \
  	  {								      \
  	    size_t written;						      \
+ 	    uint32_t temp;						      \
  									      \
  	    written = ucs4_to_ksc5601_sym (ch, outptr, outend - outptr);      \
  	    if (__builtin_expect (written, 1) == 0)			      \
***************
*** 425,438 ****
  		STANDARD_ERR_HANDLER (4);				      \
  	      }								      \
  									      \
! 	    outptr[0] -= 0x4a;						      \
! 	    outptr[1] += 0x80;						      \
! 									      \
! 	    outptr[1] += (outptr[0] % 2					      \
! 			  ? 0 : (outptr[1] > 0xee ? 0x43 : 0x31));	      \
! 	    outptr[1] -= 0xa1;						      \
! 	    outptr[0] /= 2;						      \
! 	    outptr[0] += 0xe0;						      \
  									      \
  	    outptr += 2;						      \
  	  }								      \
--- 426,435 ----
  		STANDARD_ERR_HANDLER (4);				      \
  	      }								      \
  									      \
! 	    temp = (outptr[0] < 0x4a ? outptr[0] + 0x191 : outptr[0] + 0x176);\
! 	    outptr[1] += (temp % 2 ? 0x5e : 0);				      \
! 	    outptr[1] += (outptr[1] < 0x6f ? 0x10 : 0x22);		      \
! 	    outptr[0] = temp / 2;					      \
  									      \
  	    outptr += 2;						      \
  	  }								      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]