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

JsonRecorder missing charset in OutputStreamWriter, JsonLoader uses hardcoded UTF8 #107

Closed
skrilagg opened this issue Mar 4, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@skrilagg
Copy link

skrilagg commented Mar 4, 2022

Hi,

just came across an issue with charset/encoding of recorded data:

return createObjectMapper().readValue(new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)), JsonSampleModel.class);

reads the files with UTF8 but in

final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(persistentResource.writeAsStream(StandardOpenOption.TRUNCATE_EXISTING,

no charset is configured in the OutputStreamWriter.

We use Cp1252 most of the time and when loading the data from the json file, it's corrupted then.
Maybe I'm missing a configuration that I can adjust.

Regards,
Michel

@JanSchankin JanSchankin self-assigned this Mar 5, 2022
@JanSchankin JanSchankin added the bug Something isn't working label Mar 5, 2022
@JanSchankin JanSchankin added this to the v2.0.1 milestone Mar 5, 2022
JanSchankin added a commit that referenced this issue Mar 7, 2022
@JanSchankin
Copy link
Contributor

Hi Michel,

version 2.0.1 will come with the following changes:

  • Default charset will be Charset.defaultCharset() for both JsonLoader and JsonRecorder.
  • The new annotation @UseCharset can be used to configure the charset
  • The low-level-api also has a new method to configure the charset: JsonSourceManager.builder().withCharset("cp1252").buildWithFile()

Greetings
Jan

JanSchankin added a commit that referenced this issue Mar 12, 2022
…harset_config

Bug #107 json recorder is missing charset config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants