On Tue, Aug 20, 2002 at 06:18:29PM +0200, Asger Kunuk Alstrup Nielsen wrote: > 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); > }
Since you use getISOEncoded for keyboard handling, I think that getISOEncoded should also receive the encoding of the current font: char getISOEncoded(int c, Encoding & enc) You can then use the conversion functions of QT http://doc.trolltech.com/3.0/qtextcodec.html Or, you can add a simple unicode->8bit method to the Encodings class: char Encoding::to8bit(int c) { if (c < 256 && encoding_table[c] == c) return c; for (int i = 0; i < 256; ++i) if (encoding_table[i] == c) return i; return 0; } and then getISOEncoded is just to return enc.to8bit(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