char taken from .csv file edit problem java
I have a problem....
I made a java program that does the following:
BufferedReader input = new BufferedReader(new FileReader("test.csv"));
String line = input.readLine();
int lenghtOfLine=line.length();
char[] lineIndex=new char[lenghtOfLine];
lineIndex=line.toCharArray();
Now i make some checks in a for loop such us if(lineIndex[i]=='|') or 'M'
开发者_如何转开发 and some other checks
in the same way...
The problem is that allthought the program run correct on windows 7, vista , xp (english and greek)
when i try to run it
on windows vista (German) it seems like the check lineIndex[i]=='|'
is always false**
why this happen? The test.csv file is the same.. and i am sure that '|' exists in every line..
Is there a problem with unicode or something??
how can i make this program run in every language
The test.csv file is always the some downloaded from the web
I am sorry for my English. Thanks in advance..
The API specifies that FileReader will assume that the default character encoding of the machine on which it runs.
If you knew the CSV was UTF-8 encoded you could try:
FileInputStream fis = new FileInputStream("test.csv");
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader input = new BufferedReader(isr);
精彩评论