New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent default encoding in FlatFileItemReader and FlatFileItemWriter #1154
Comments
Mahmoud Ben Hassine commented The fact that the |
resolves spring-projects#1154 It now matches the encoding scheme of FlatFileItemReader
resolves spring-projects#1154 It now matches the encoding scheme of FlatFileItemReader
resolves spring-projects#1154 It now matches the encoding scheme of FlatFileItemReader
resolves spring-projects#1154 It now matches the encoding scheme of FlatFileItemReader
Ant Kutschera opened BATCH-2448 and commented
We have a batch component which writes to an interjob file and another which reads from that file. They write and read using FlatFileItemWriter and FlatFileItemReader respectively.
Unfortunately the data which is read is no longer correct (our umlaut characters are corrupt), but the data in the interjob file is correct. This happens because the default encoding for FlatFileItemReader is not the same as the default encoding for FlatFileItemWriter. Looking at the source, they are:
org.springframework.batch.item.file.FlatFileItemReader#encoding = #DEFAULT_CHARSET = Charset.defaultCharset().name()
org.springframework.batch.item.file.FlatFileItemWriter#encoding = #OutputState.DEFAULT_CHARSET = "UTF-8"
I.e. the writer is hard coded to UTF-8 but the reader is environment specific.
Ideally the reader and the writer would use the same default regardless of the environment.
The work around is to set the encoding specifically to UTF-8 on the reader.
Affects:
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-infrastructure</artifactId>
<version>3.0.4.RELEASE</version>
Affects: 3.0.4
The text was updated successfully, but these errors were encountered: