Hi,
I want to read a text file that has some unicode (\u0259) chars and some regular chars. An example line from the text file:
a=,\u0251,e=,\u0259,e*,\u025b,i*,\u026a,n=,\u014b,?,\u0294
Here is my code:
FileInputStream fInputStream = new FileInputStream(file);
BufferedReader bReader = new BufferedReader(new InputStreamReader(fInputStream, "UTF8"));
String line = null;
while ((line = bReader.readLine()) != null) {
String[] schemes = line.substring(0).split(",");
. . . pair off the elements in the line and add them to an ArrayList . . .
}
My problem is in that it reads the \ char as a char and not a unicode escape character. Watching the line or schemes variable in NetBeans shows the line above like this:
"a=,\\u0251,e=,\\u0259,e*,\\u025b,i*,\\u026a,n=,\\u014b,?,\\u0294"
Java.lang.string is a bit too helpful here in preserving the slashes. Is there away to get it to read the line without putting the extra slash in there?
If I manually type in the pairs, it displays them correctly.
List pairs = new ArrayList();
pairs.add("a=" + "," + "\u0251");
pairs.add("e=" + "," + "\u0259"); pairs.add("e*" + "," + "\u025b");
pairs.add("i*" + "," + "\u026a");
No double slashes and it displays fine in my program. Any help will be greatly appreciated.
ktx