Java encoding

For one of our projects I had to write a simple program, for importing items into our online store ( When I finished the coding everything seemed to run smooth, but only on Windows. Afterwards I tested the program on my linux box and it did not work.

After checking all files I found out that the encoding of the files was wrong for importing into our shop. With the help of google and some other sites the problem was solved. I had to use ISO-8859-1 for all files, because the core data is 8859.

To read a file I use the following code now:

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(),”ISO-8859-1″));

and to write:

Writer bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), “ISO-8859-1”));

I hope this will help someone who has a similar problem.



1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)