• Post Reply Bookmark Topic Watch Topic
  • New Topic

Right to Left Languages is Java  RSS feed

 
Mark Hogan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I know that Java uses unicode for displaying strings and characters , But when i want to output a right to left languge like Arabic , by using Java and unicode , strange things is displayed on screen . This happens in both applets and applications . But when i run my code in IDEs like NetBeans , everything is good and there is no problem . What should i do to solve this problem ?
Thanks
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the output different between Netbeans and manually run? Is the text garbage or the direction is wrong or something else?
 
Mark Hogan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It produces text garbage
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the ranch Mark Hogan.

I think what happens depends on the OS and where you are displaying it.Try that. My Hebrew is less than rudimentary, but I think it is supposed to say Hallelujah!
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:but I think it is supposed to say Hallelujah!


It seems to be written right-to-left.
Is it a property of a Unicode character which direction it prefers?
Or is that Swing thingy that is so cute?
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I tried it, I got it right‑to‑left on the option pane and left‑to‑right on the command line That was on bash. I think that shows the directionality is platform dependent.
I think it should have read "\u05d7\u05dc\u05dc\u05d5\u05d9\u05d7", with two לs.
 
Campbell Ritchie
Marshal
Posts: 56562
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the platform should be able to detect the directionality from the characters. If I try embedding such Hebrew in an open office/libre office document, I find the behaviour of the cursor varies if I move it onto and off that text.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:Is it a property of a Unicode character which direction it prefers?


Yes. Read Bi-directional text for more information about that.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Read Bi-directional text for more information about that.


Thanks for the hint, it is a useful link. Indeed:


In Unicode encoding, all non-punctuation characters are stored in writing order. This means that the writing direction of characters is stored within the characters.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!