On Mon, 19 Aug 2002, Juergen Vigna wrote:
> > On more important things: what do you want to do with getISOEncoded or
> > whatever?
>
> Well the X input routine needs such a beast and we need it for the
> keyboard handling. Have a look at how this is encoded for the XForms
> frontend, now John has the problem that he doesn't have the base we
> use for the xforms frontend to call the appropriate X function for it
> and he's asking if someone knows about how to do it.
>
> Maybe Asger knows something about this and how it could be possible
> to encode maybe if we cry louder *ASGER* he will hear us ;)
I forget the exact prototype of this function, but I'm sure you can
implement it if you wriggle it to use a helper like this:
char getISOEncoded(int unicode_character) {
return unicode_character & 0xff;
}
This will work for ISO-8859-1, and this will get you started.
If you want to do the real thing with support for ISO-8859-2 and other
encodings, then do like this:
char getISOEncoded(int c) {
if (c < 0x100) {
// ISO-8859-1
return c & 0xff; // This converts Unicode characters to ISO-8859-1
}
if (c is in ISO-8859-2) {
return convert_unicode_to_iso8859_2(c);
}
if (c is in ISO-8859-3) {
return convert_unicode_to_iso8859_3(c);
}
..etc..
if (c is X-encoding, where X is an 8-bit encoding) {
return convert_unicode_to_X_encoding(c);
}
}
So, it is pretty easy, although a bit cumbersome to implement
all these "c is in X encoding" and convert_unicode_to_X functions.
I have tried to explain this before, but seemingly unsuccesful.
Please let me know if you understand now.
I do not believe X provides much help for this, except for maybe
the "convert_unicode_to_X" functions in modern X-versions.
Greets,
Asger