Link to home
Start Free TrialLog in
Avatar of Onionsinger
Onionsinger

asked on

Arabic characters displaying in Chinese in Delphi 5

I have written an application using Delphi 5. I have a user in Yemen who has been entering patient names into the program for years in Arabic. I have done nothing in my own coding to support this, but apparently it works for him. The characters end up encoded inside the string with characters like chr(227), chr(228), chr(213) etc. Ā For years, when I display these names on the screen, they appear in Arabic, just as he wishes.
Suddenly, in just one place in the software (a TStringGrid), when I display the name, it now appears using Chinese letters instead of Arabic letters. Again, I did nothing to command Delphi to do this. I have no idea why this is happening. I can reproduce the problem on my own computer (Windows 7 using its default settings, not changing the control panel region and language to anything else). The font of the TStringGrid is 'System' with CharSet of 1 (the default), point size of 10; the other location is a TEdit with the same Font ('System'), CharSet of 1, point Size of 10. I can't see anything that I changed inside my own code involving this step which would change the way it displays text. The problem also occurs on his computers which are running Windows XP.

I discovered that if I change the charset of the TStringGrid to 178 (ARABIC_CHARSET) I can force Delphi to display the names in a script form of Arabic, but it does look different from the printed form of Arabic which appears in the TEdit.

In any case, I am not telling Delphi to use Unicode or any other fancy thing, and I simply have no idea why it would suddenly decide to display in Chinese rather than Arabic. Does anyone know why, or any other way around this issue?

This does not involve using the Internet at all; it simply runs on a computer.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Onionsinger
Onionsinger

ASKER

I solved this even before reading the above comment, but I give the author credit.
DEFAULT_CHARSET is the same as a value of 1 (see Delphi help under TCharSet)
I had searched my code in vain for a location where I had changed the font or charset, and found no place where I had done so.
However, I had overlooked the fact that the charset can also be set in the Object Inspector. This is what caused the problem. I apparently had accidentally pressed a key while the charset line was the highlighted line, causing it to change to HANGEUL_CHARSET, which is actually the Korean alphabet. Neither the user nor myself can read Chinese nor Korean, so we mistook the Korean letters for Chinese letters. In any case, changing the charset back to DEFAULT_CHARSET in the Object Inspector solved the problem. The program that displays Arabic characters if that is how the user has set up Windows as the default language, rather than forcing the characters to be Korean.