From: Dmitry V. <dv...@ro...> - 2004-04-10 15:27:15
|
Hi Joe, On Friday 09 April 2004 04:51, 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=20 > they simply not appear? Well, this problem was reported on a Russian-speaking mailing list. The=20 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=20 device itself has no such problems and the problem lies elsewhere. It=20 is also neither font related nor caused by the built-in translation of=20 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.=20 Unicode QStrings Line1 and Line2 currently get their values from the raw string obtained from the device (with special symbols translated). From=20 the output of 'ptal-hp display' we have found out that ISO8859-5 is=20 used for Cyrillic text in the device. Now what we need is to explicitly=20 specify the encoding of the text received from the device so that it=20 will be converted to Unicode correctly. In this regard xojpanel.cpp=20 could be changed as follows: QTextCodec *codec =3D QTextCodec::codecForName(deviceEncoding); // in our case deviceEncoding =3D=3D "iso8859-5" Line1 =3D codec->toUnicode(tmpString.remove( length - spaces, spaces )); I suggest adding an extra command line option to xojpanel like=20 =2Ddeviceenc <encoding> to set the value of deviceEncoding manually. The default would be iso8859-1 then. Of course it would be nice to be able=20 to retrieve the encoding from the device itself based on some kind of=20 PML object that is set to a language it's using for the LCD. But for=20 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=20 iso8859-5. Therefore, the above mentioned convertion from iso8859-5 to=20 Unicode would corrupt the arrows and show something weird instead of=20 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=20 an official standard, it's almost never used :-) Yes, and one more thing not really connected with encodings. Messing=20 with xojpanel's source I found out that my PSC 2110 uses a special=20 character 0x15 for the right arrow. Previously xojpanel showed no right=20 arrows for this device at all, though they were present on the LCD.=20 Adding 0x15 to the translation map fixed that. =2D-=20 Dmitry Vukolov |