A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
I/O and Streams
Reading a text file while controlling BIDI algorithm (visual BIDI)?
Joined: Nov 13, 2002
May 03, 2007 19:19:00
I need to read some text files, containing Left-To-Right text(Hebrew and Arabic, yet the two languages never appear in the same file).
Unfortunately, the files were written by some ancient homemade DOS program, some 20 years ago.
It used the following algorithm:
Char encoding : IBM CP 824 (Arabic) , IBM CP 826 (Hebrew).
Ordering: 'Visual BIDI Ordering' , i.e. foreign words are reversed, while numbers/English remain intact (Note it's not a simple GUI issue - the data was physically stored in reverse order).
Now, I was hoping to find a proper encoding, in the lines of:
FileInputStream fin=new FileInputStream(file); String encode= ... // QUestion: Is there some proper encoding here? InputStreamReader rd=new InputStreamReader(fin, encode); rd.read(...);
Unfortunately, I can't find a java-supported encoding that supports *both* the char encoding and the ordering...
encode="IBM862" produces the correct letters, but in wrong order
encode="ISO-8859-8" produces gibberish letters, but in correct order
Does anyone please happen to know - is there a supported encoding for "IBM862 Visual" ?
If not - is there at least some reliable
implementation for "BIDI with visual (reversed) ordering" ?
[ May 03, 2007: Message edited by: Sol Mam-Orn ]
rocket mass heater
subject: Reading a text file while controlling BIDI algorithm (visual BIDI)?
Reading unicode characters from a file
How a character save in 2 bytes in Java?
How to convert a character into unicode
How to read data from a text file
Unable to read Arabic data
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015