From: Dmitry V. <dv...@ro...> - 2004-04-10 00:02:47
|
Hi Joe, Joe Piolunek wrote: > Can you supply more info about the issue? Which peripherals (that you > know of) exhibit the problem? Do the Cyrillic characters display > correctly on the device's built-in LCD screen (under Linux)? Are only a > few characters displayed incorrectly? When characters are not displayed > correctly, do other characters appear in their place, or do they simply > not appear? Well, this problem was reported on a Russian-speaking mailing list. The guy used xojpanel to view the LCD of a Color LaserJet 4550. All Latin characters are displayed properly, Cyrillic ones -- not. I'm sure the device itself has no such problems and the problem lies elsewhere. It is also neither font related nor caused by the built-in translation of special characters. > Unfortunately, I'm not very familiar with internationalization issues. A > little reading turned up the lesstif/Motif/openMotif function > "XmStringCreateLocalized(text)", which at first glance looks like it might > be possible to use it as a conversion wrapper for the strings 'Line1' and > 'Line2' in xojpanel.cpp, but I'm really just guessing at this point. Unicode QStrings Line1 and Line2 currently get their values from the raw string obtained from the device (with special symbols translated). From the output of 'ptal-hp display' we have found out that ISO8859-5 is used for Cyrillic text in the device. Now what we need is to explicitly specify the encoding of the text received from the device so that is will be converted to Unicode correctly. In this regard xojpanel.cpp could be changed as follows: QTextCodec *codec = QTextCodec::codecForName(deviceEncoding); // in our case deviceEncoding == "iso8859-5" Line1 = codec->toUnicode(tmpString.remove( length - spaces, spaces )); I suggest adding an extra command line option to xojpanel like -deviceenc <encoding> to set the value of deviceEncoding manually. The default would be iso8859-1 then. Of course it would be nice to be able to retrieve the encoding from the device itself based on some kind of PML object that is set to a language it's using for the LCD. But for now that's just dreams :-) 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. > Is there any other encoding that could be used to display > Cyrillic? If iso8859-5 contains all of the needed characters for Russian > and Russian-related languages, it probably would be the one used. KOI8-R and CP1251 are much more common. And though ISO8859-5 is called an official standard, it's almost never used :-) Yes, and one more thing not really connected with encodings. Messing with xojpanel's source I found out that my PSC 2110 uses a special character 0x15 for the right arrow. Previously xojpanel showed no right arrows for this device at all, though they were present on the LCD. Adding 0x15 to the translation map fixed that. -- Dmitry Vukolov |