Skip to content
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

FlatFileItemWriter now uses charset to determine default encoding #3910

Closed
wants to merge 2 commits into from

Conversation

cppwfs
Copy link
Contributor

@cppwfs cppwfs commented May 17, 2021

resolves #1154

It now matches the encoding scheme of FlatFileItemReader

*/
public class FlatFileItemWriter<T> extends AbstractFileItemWriter<T> {

protected LineAggregator<T> lineAggregator;

// default encoding for writing to flat files - set to charset of this Java virtual machine.
public static final String DEFAULT_CHARSET = Charset.defaultCharset().name();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a DEFAULT_CHARSET constant in AbstractFileItemWriter. It is that value that should be changed instead of adding a new constant here.

@fmbenhassine fmbenhassine added the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Sep 3, 2021
resolves spring-projects#1154

It now matches the encoding scheme of FlatFileItemReader
@cppwfs
Copy link
Contributor Author

cppwfs commented Sep 3, 2021

I will update this in the PR. The issue mentions FlatfileItemWriter specifically and Ididn't want to affect other classes that inherit from AbstractFileItemWriter for example JDBCFileItemWriter.
Thanks for the code review!

@cppwfs cppwfs force-pushed the BATCH-1154 branch 3 times, most recently from f3ae970 to 23a7b6b Compare September 3, 2021 18:23
@fmbenhassine fmbenhassine removed the status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter label Sep 3, 2021
@fmbenhassine fmbenhassine added this to the 5.0.0-M1 milestone Sep 9, 2021
@fmbenhassine
Copy link
Contributor

Rebased and merged as 6c619b9. Thank you @cppwfs !

fmbenhassine added a commit that referenced this pull request May 17, 2022
This commit overrides the fix in #3910 by using UTF-8
as default encoding in file-based item readers and writers.

Issue #1154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent default encoding in FlatFileItemReader and FlatFileItemWriter
2 participants