This is the mail archive of the libc-alpha@cygnus.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]

localedef can not treat multi byte characters


>Submitter-Id:	net
>Originator:	Shinya Hanataka
>Organization:	no
>Confidential:	no
>Synopsis:	localedef can not treat multi byte characters
>Severity:	non-critical
>Priority:	medium
>Category:	libc
>Class:		sw-bug
>Release:	libc-2.0.111
>Environment:
	PC-clone, pentium CPU, Linux 2.2.0pre7
Host type: i586-pc-linux-gnu
System: Linux chaos 2.2.0-pre7 #13 SMP Sun Jan 17 00:07:47 JST 1999 i586 unknown
Architecture: i586

Addons: crypt linuxthreads
Build CFLAGS: -O3 -mpentium
Build CC: gcc
Compiler version: pgcc-2.91.60 19981201 (egcs-1.1.1 release)
Kernel headers: 2.2.0-pre7
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio

>Description:
	(1) localedef program can not treat multibyte character on LC_XXXX .
	    (for all east asian character code);
	(2) localedef program can not treat charmaps with MB_CUR_MAX > 4.
	    (for some ISO-2022 based character code);
>How-To-Repeat:
	(1) Define multi bytes character at charmap file.
		<j0101>...<j0194>      /xa1/xa1   JIS X 0208 KANJI
	    Use that code on locale source file.
		currency_symbol         "<j0179>"
	(2) Define <mb_cur_max> 5 on charmap file.
>Fix:
	(1) Simple, but not essential patch, below.
	(2) I have no idea, maybe need char* instead of long for MB characters.

--- glibc-2.0.111.orig/locale/programs/stringtrans.c	Sun Jan 24 16:11:55 1999
+++ glibc-2.0.111/locale/programs/stringtrans.c	Sun Jan 24 11:57:23 1999
@@ -115,9 +115,17 @@
   switch (encoding_method)
     {
     case ENC_UCS1:
-      if (value > 255)
-	return -1;
-      *(*cpp)++ = (char) value;
+      /* We NEED multi byte character, here */
+      if (value >= 0x1000000) {
+	*(*cpp)++ = (char) ((value >> 24) & 0xff);
+      }
+      if (value >= 0x10000) {
+	*(*cpp)++ = (char) ((value >> 16) & 0xff);
+      }
+      if (value >= 0x100) {
+	*(*cpp)++ = (char) ((value >> 8)  & 0xff);
+      }
+      *(*cpp)++ = (char) (value & 0xff);
       break;
 
     case ENC_UCS4:

-- 
HANATAKA Shinya <hanataka@abyss.rim.or.jp>


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