From: Joe P. <joe...@sn...> - 2004-04-11 16:26:43
|
On Friday 09 April 2004 08:02, Dmitry Vukolov wrote: <...> > Anyway, even in the proposed solution there is a catch related to those > special characters that HP uses for arrows and such. The built-in > translation maps them to e.g. '>>' that simply doesn't exist in iso8859-5. > Therefore, the above mentioned convertion from iso8859-5 to Unicode would > corrupt the arrows and show something weird instead of them. I'll try to > come up with something to overcome this. Dmitri: Thanks for sending the patch. I didn't notice any problems here after applying it, but I can't fully test it due to my not having a device that uses "special characters". At least I haven't seen my OfficeJet 600 display any of them. Comparing the iso8859-5 chart I found(if it's correct)with Latin1 shows several of the "special" characters missing. By declaring characterTranslationMap and characterMap as type wchar_t instead of 'unsigned char', I had some success doing the character substitutions using the characters' unicode designation. It would only work though, if the needed characters are available on the user's system. For example, a section something like this in XojPanel::buildCharacterMap could be added for each new region where a native user is willing to suggest substitute characters. // Due to differences in the encodings, some // characters need to be remapped for iso8859-5. if (qstrcmp (deviceEncoding, "ISO8859-5") == 0) { characterMap[0x10] = 0x3c; // '<' characterMap[0x80] = 0x3c; // '<' characterMap[0xa0] = 0x3c; // '<' characterMap[0x11] = 0x3e; // '>' characterMap[0x13] = 0x3e; // '>' characterMap[0x15] = 0x3e; // '>' characterMap[0x81] = 0x3e; // '>' characterMap[0x12] = 0x00a3; // unicode "British Pound" sign // Some tests: // remaps 'A' to British Pound sign. //characterMap[0x41] = 0x00a3; // remaps 'A' to one of the Cyrillic chars. // characterMap[0x41] = 0x04c1; // (test) remaps 'A' to one of the Katakana chars. // characterMap[0x41] = 0x30b7; All of the tests above worked for me. It could be possible to use unicode for all of the character substitutions, allowing special remaps for (hopefully just a few) different regions. What I've described sounds a little too easy. Do you know of any problems with doing the remapping using unicode designations? I don't know which would be better - having the end-user specify the encoding ("xojpanel -devenc ISO8859-5"), or regional charset ("xojpanel -cyrillic"). What's your opinion on this? Thanks. -- Joe |