I'm using spring batch to read csv files, when I open these files with Notepad++ I see that the used encode is encode in ANSI
.
Now when reading a line from a file, I notice that all accent character are not shown correctly. For example let's take this line:
Données issues de la reprise des données
It's transformed to be like this one with some special characters:
So as first solution I set the encode for my Item Reader to utf-8
but the problem still exist.
- I thought that with
UTF-8
encoding all my accent characters will be recognized, is that not true ? from what I heard UTF-8 is the best encoding to use to handle all character on web page for example ?
After setting my item Reader encoding to ISO-8859-1
:
public class TestItemReader extends FlatFileItemReader<TestFileRow> {
private static final Logger log = LoggerFactory.getLogger(TestItemReader.class);
public ScelleItemReader(String path) {
this.setResource( new FileSystemResource(path + "/Test.csv"));
this.setEncoding("ISO-8859-1");
I cant see that these character are now displayed correctly.
- As output I should write with
utf-8
as encoding, did this is correct if I useISO-8859-1
as encoding input andutf-8
as output?