Skip to content

Set UTF-8 Encoding for Reading Files. #122

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

Closed
jeschkies opened this issue Jun 4, 2015 · 3 comments
Closed

Set UTF-8 Encoding for Reading Files. #122

jeschkies opened this issue Jun 4, 2015 · 3 comments
Milestone

Comments

@jeschkies
Copy link

We had the following exceptions on generating the coverage: java.nio.charset.MalformedInputException: Input length = 1. It turned out that Scoverage sets an UTF-8 encoding for writing files but not for reading, e.g. in CodeGrid. I suggest Source.fromFile(mfile.source, "UTF-8").mkString because Scoverage should not rely on the JVM default encoding if it is using UTF-8 for writing.

@ckipp01
Copy link
Member

ckipp01 commented May 11, 2021

Thanks for bringing this up, it's a solid point. It looks like this was actually added to the ScoverageHtmlWriter, but not the other writers. So while even in sbt there is a setting key to set the encoding, it will only be applied to the html reports. I plan to fix this and align the various writers to all have the same behavior where you can pass in an encoding, and if not, it will default to utf-8. Right now the behavior is actually a bit different and for backwards compatibility reason it defaulted to system, but I want to assume that most of the time, in fact almost all of the time, that's not desired.

@jeschkies
Copy link
Author

Thanks for addressing this. I should have proposed a change back then 🙈 🙂

@ckipp01 ckipp01 added this to the 2.0 milestone Sep 27, 2021
ckipp01 added a commit that referenced this issue Sep 27, 2021
* Ensure utf8 encoding is defaulted everywhere.

Closes #122
Closes #326

Relates to #368

* Bump timeout in test for concurrency tests on windows
@ckipp01
Copy link
Member

ckipp01 commented Sep 27, 2021

Closed via #390

@ckipp01 ckipp01 closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants