Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Mar 2008 19:55:21 GMT
From:      Yuri <yuri@tsoft.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/122091: [PATCH] [PORT chinese/chinput3] fixed locale problem
Message-ID:  <200803251955.m2PJtLqL081611@www.freebsd.org>
Resent-Message-ID: <200803252000.m2PK03G8085307@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         122091
>Category:       ports
>Synopsis:       [PATCH] [PORT chinese/chinput3] fixed locale problem
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 25 20:00:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Yuri
>Release:        7.0-STABLE
>Organization:
n/a
>Environment:
>Description:
chinput3 was expecting non-existent in FreeBSD chinese locales.
Please apply the patch, it makes it run.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -uNr chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_resource_Chinput.ad chinese/chinput3/files/patch-src_Chinput-3.0.2_resource_Chinput.ad
--- chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_resource_Chinput.ad	1969-12-31 16:00:00.000000000 -0800
+++ chinese/chinput3/files/patch-src_Chinput-3.0.2_resource_Chinput.ad	2008-03-25 12:32:59.000000000 -0700
@@ -0,0 +1,13 @@
+--- src/Chinput-3.0.2/resource/Chinput.ad.orig	2008-03-25 12:16:09.000000000 -0700
++++ src/Chinput-3.0.2/resource/Chinput.ad	2008-03-25 12:21:36.000000000 -0700
+@@ -2,8 +2,8 @@
+ !It based on chinput
+ 
+ 
+-chinput.gblocale	=	zh_CN.EUC
+-chinput.big5locale	=	zh_CN.EUC
++chinput.gblocale	=	zh_CN.GB2312
++chinput.big5locale	=	zh_CN.GB2312
+ 
+ !
+ ! input style: AUTO, ROOT, OVERSPOT, ONSPOT, OFFSPOT
diff -uNr chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_src_init.c chinese/chinput3/files/patch-src_Chinput-3.0.2_src_init.c
--- chinese/chinput3.orig/files/patch-src_Chinput-3.0.2_src_init.c	1969-12-31 16:00:00.000000000 -0800
+++ chinese/chinput3/files/patch-src_Chinput-3.0.2_src_init.c	2008-03-25 12:32:36.000000000 -0700
@@ -0,0 +1,32 @@
+--- src/Chinput-3.0.2/src/init.c.orig	2008-03-25 11:18:01.000000000 -0700
++++ src/Chinput-3.0.2/src/init.c	2008-03-25 12:23:41.000000000 -0700
+@@ -94,6 +94,13 @@
+         load_font(&font_info, font_latin);
+ }
+ 
++static int is_locale_supported(char *locale) {
++  char *setlocale_string = setlocale(LC_ALL, locale);
++  int success = (setlocale_string != NULL && strcmp(setlocale_string, locale)==0 && XSupportsLocale());
++  if (!success && locale[0] != 0 && setlocale_string != NULL && setlocale_string[0] != 0) {
++    fprintf(stderr, "Error : requested locale '%s' not supported\n");
++  }
++}
+ 
+ void HZinitServerGC(void)
+ {
+@@ -103,12 +110,9 @@
+ 	char fontname[256];
+ 
+ 	//create font set
+-	if(strcmp(setlocale(LC_ALL, gb18030locale), gb18030locale) || 	
+-		!XSupportsLocale()){
+-		if(strcmp(setlocale(LC_ALL, gbklocale), gbklocale) ||
+-			!XSupportsLocale()){
+-			if(strcmp(setlocale(LC_ALL, gblocale), gblocale) ||
+-				!XSupportsLocale()){
++	if(!is_locale_supported(gb18030locale)){
++		if(!is_locale_supported(gbklocale)){
++			if(!is_locale_supported(gblocale)){
+ 				fprintf(stderr, "Error : Chinese Locale not supported!\n");
+ 				exit(1);
+ 			}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803251955.m2PJtLqL081611>