| Author |
Strange behavior of the JVM related to Arabization(Localization)
|
Mahmoud Hadad
Ranch Hand
Joined: Jan 09, 2006
Posts: 67
|
|
hi evreyone, i had alot of problems in displaying arabic text either when getting them from a DB query, storing them and even printing some arabic text to the console.the problem was that i could write arabic using netbeans in my code but when i try to System.out.printlnt(arabicStrObj) it prints ???.after trying many siviral times it showed the text while i did not change anything neither in my system nor in my coce.the system default is english but i have arabic installed, i'm using Windows XP sp2 the default encoding printed is Cp1256 when i tried to print a Greek letter the JVM rendered it as ?, what does it mean that the JVM supports Unicode and my system(Windows xp sp2) has the installed fonts for representing the glyp of those Unicode Characters but they do not get rendered correctly?
|
 |
Joni Salonen
Ranch Hand
Joined: Jan 07, 2006
Posts: 53
|
|
If by "console" you mean the infamously incapable "MS DOS prompt" on Windows, I would be surprised if it could show arabic and greek letters. If you want text to be shown correctly, reliably and platform independently, it's best to use a graphical user interface. [ September 21, 2006: Message edited by: Joni Salonen ]
|
 |
Mahmoud Hadad
Ranch Hand
Joined: Jan 09, 2006
Posts: 67
|
|
|
my operating system has an arabic command prompt window, it's not an MS-DOS problem or an operating system problem i think as the DB problems was in GUI mode, although i have arabic installed in my system but the JVM is working in a mysterious way, i have used Arabic Transperent font in my GUI App but my data was not rendered correctly
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
You may as well forget about using the console if you have any non-Latin scripts (Arabic, Cyrillic, Greek, Bengali, and on and on), because your system's default charset is likely to be different from the code page used by the console. Use a GUI to test things. But you said the data was "not rendered correctly" in your GUI. What does that mean? In general, if you see question marks then you have charset problems. That would probably mean that your database needs to be configured differently, but sometimes people do strange things in their code to try to work around those problems that just make them worse. But if you see rectangular boxes then you have a font that can't render the characters. You surely have the fonts available on your system, but you might have to call setFont() on your GUI components to use them.
|
 |
Mahmoud Hadad
Ranch Hand
Joined: Jan 09, 2006
Posts: 67
|
|
|
well i have changed Regional Options in Regional Settings in Control Panel to match an arabic country and an arabic prefrences and it made the JVM render the arabic characters correctly but what if my user will be outside an arabic country and he does not wish to change his regional settings, is there anyway i can render the arabic text for example although he have pre-installed arabic in his os but his regoinal and language settings are not set to any arabic matching country
|
 |
Joni Salonen
Ranch Hand
Joined: Jan 07, 2006
Posts: 53
|
|
|
What do you use for GUI? In swing, Arabic and Greek should work out-of-the-box, without changing any settings. The default font which comes with Sun's runtime environment has glyphs for them. If the data you retrieve from the DB is fine there won't be any problems with displaying it. So, like Paul said, if you have problems displaying, it means that the problem is likely with how you retrieve data from the database, rather than with the rendering process.
|
 |
 |
|
|
subject: Strange behavior of the JVM related to Arabization(Localization)
|
|
|