Arabic characters displaying in Chinese in Delphi 5

Posted on 2013-10-02
Medium Priority
Last Modified: 2013-10-03
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.
Question by:Onionsinger
LVL 28

Accepted Solution

Sinisa Vuk earned 1500 total points
ID: 39542528
- set Charset back to DEFAULT_CHARSET
- set same font as in TEdit
- set ParentFont to False

Is all texts in TstringGrind incorrect?
From where and how you get texts for StringGrid?

Author Closing Comment

ID: 39542739
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question