I am trying a fileWriter code with utf-8 encoding as my file contents contain French characters. File writer code:
Charset charset = Charset.forName("UTF-8");
Writer writer = new OutputStreamWriter(new FileOutputStream(file), charset);
beanWriter = factory.createWriter(input,writer);
When I try to open the target file in a windows machine, it shows the name properly. While in Linux, if I open the file that is written, Example : CAMRôN from the original file is shown as CAMR�N
Current encoding in windows is UTF-8 and in linux as well its UTF-8
When I try to change it to other formats using iconv, it throws up an error
CAMRiconv: illegal input sequence at position 36
What should I do to avoid this junk character being displayed in linux. Is there anything missing in here? please help!