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| 女,敌人开户;后如脱兔,敌不及拒。
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"),
Reply to: