I have a program that users can input arabic text on text area. arabic text direction is right to left, and when i write the text to the file, Text's direction change to left to right. Can I write the arabic text to file with direction is right to left?
Asked
Active
Viewed 1,950 times
4
-
Encoding setting problem - See `Accessing files: (Input/Output)` from the given link: http://ahm507.blogspot.com/2006/12/java-and-arabic-support.html ...still need to check the current locale setting of the client OS and Java application to make sure they are the same locale – eee Mar 23 '11 at 07:45
-
more: http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding and "file.encoding" property is not supposed to modified by user; use Locale instead http://bugs.sun.com/view_bug.do?bug_id=4163515 – eee Mar 23 '11 at 08:03
-
more: http://www.chinesecomputing.com/programming/java.html and http://illegalargumentexception.blogspot.com/2009/05/java-rough-guide-to-character-encoding.html – eee Mar 23 '11 at 08:12
4 Answers
1
Reverse the text in memory then write it to disk. Reverse the reverse...
StringUtils.reverse(str)

jeverest
- 44
- 2
-
Use it with care for Unicode characters involving surrogate pairs...se http://download.oracle.com/javase/tutorial/i18n/text/design.html – eee Mar 23 '11 at 07:51
0
You don't need to. Its upto the displaying program to show it in the right direction. You can store the data in file as it is, and the guy who reads it and displays it is responsible for that.

Suraj Chandran
- 24,433
- 12
- 63
- 94
0
The direction desplayed depends on the program you open your file with. All you can do is to use Unicode and if the opening program has problems with Unicode you can do nothing about it. The OS where file opened on should support Unicode as well.

CloudyMarble
- 36,908
- 70
- 97
- 130