UTF-8 input (was Re: Arphic font, Unicode, fontset and various)
On Sun, Dec 09, 2001 at 08:04:17PM +0800, hashao@chinese.com wrote:
> On Fri, Dec 07, 2001 at 08:45:06PM +0800, hashao@chinese.com wrote:
> And now you can input your UTF-8.
>
> XCIN too!
> With the attached patch, xcin will do the same thing. Cool, huh?
>
hmm... add some error check. take 2.
Patch attached.
--
hashao| 是故政舉之日,夷關折符,無通其使,厲于廊廟之上,以誅其事。敵人開
hashao| 闔,必亟入之,先其所愛,微與之期,踐墨隨敵,以決戰事。是故始如處
hashao| 女,敵人開戶;後如脫兔,敵不及拒。
--
| This message was re-posted from debian-chinese-gb@lists.debian.org
| and converted from gb2312 to big5 by an automatic gateway.
diff -ur xcin-2.5.2.99.pre2.orig/src/xim.c xcin-2.5.2.99.pre2/src/xim.c
--- xcin-2.5.2.99.pre2.orig/src/xim.c Tue Nov 27 23:42:03 2001
+++ xcin-2.5.2.99.pre2/src/xim.c Sun Dec 9 20:25:00 2001
@@ -1033,11 +1033,30 @@
XIMEncodings encodings;
Window mainwin;
locale_t *locale;
+ char* imlocale = NULL;
int i;
transport_type = TRANSPORT_X;
xccore = core;
locale = &(xccore->xcin_rc.locale);
+
+ {
+ char *pdot;
+ int plen;
+ int llen;
+ if(pdot = strchr(locale->lc_ctype, '.')){
+ plen = pdot - locale->lc_ctype;
+ llen = strlen(locale->lc_ctype);
+ imlocale = (char*)xcin_malloc(sizeof(char)*(plen+llen+1), 1);
+ sprintf(imlocale, "%s,", locale->lc_ctype);
+ strncat(imlocale, locale->lc_ctype, plen);
+ printf("%s\n", imlocale);
+ }
+ else
+ imlocale = strdup(locale->lc_ctype);
+ }
+
+
/*
if (transport_type == TRANSPORT_LOCAL) {
char hostname[64];
@@ -1075,7 +1094,7 @@
IMServerWindow, mainwin,
IMModifiers, "Xi18n",
IMServerName, xim_name,
- IMLocale, locale->lc_ctype,
+ IMLocale, imlocale,
IMServerTransport, transport,
IMInputStyles, &(xccore->input_styles),
IMEncodingList, &encodings,
@@ -1083,6 +1102,8 @@
IMFilterEventMask, KeyPressMask,
IMOnKeysList, &on_keys,
NULL);
+ free(imlocale);
+
if (ims == 0)
perr(XCINMSG_ERROR,
N_("IMOpenIM() with name \"%s\" transport \"%s\" failed.\n"),
--
| This message was re-posted from debian-chinese-gb@lists.debian.org
| and converted from gb2312 to big5 by an automatic gateway.
Reply to: