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

Enforce UTF-8 encoding when reading source files (fixes build on Windows) #270

Merged

Conversation

NPException
Copy link
Contributor

@NPException NPException commented May 28, 2020

[EDIT-2] Here's the error I get: (there's a total of 6 of these errors, all complaining about an unmappable character for the windows-1552 encoding)

ReportEntryExtensionTests.java:377: error: unmappable character (0x9D) for encoding windows-1252
	"And the only word there spoken was the whispered word, “Lenore?�?",

Due to Gradle using the operating system default encoding, the build failed on Windows. Explicitly telling Gradle to use UTF-8 solves that issue.

[EDIT] I don't know why the automatic Windows build was passing without this. Didn't work on my machine. 😅

I have no idea if this is the preferred way of setting the encoding, but it was the first working thing I could find.

I also found this snippet as a general solution, but it's from a post from 2012, and I have no clue how to translate it to the Gradle Kotlin:

tasks.withType(Compile) {
    options.encoding = 'UTF-8'
}

I hereby agree to the terms of the JUnit Pioneer Contributor License Agreement.

Due to Gradle using the operating system default encoding,
the build failed on Windows. Explicitly telling Gradle
to use UTF-8 solves that issue.
@sonarcloud
Copy link

sonarcloud bot commented May 28, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@NPException
Copy link
Contributor Author

NPException commented May 28, 2020

Quick note: I did a bit of research, and the reason the automated Windows builds passed, is that Windows Server 2019 uses UTF-8 as the system default encoding.
Unfortunately, good old Windows 10 uses Windows-1252 encoding.

@Bukama
Copy link
Member

Bukama commented May 28, 2020

Do you replay to #249, which was based on my Discord message from May 1st?

ReportEntryExtensionTests.java:377: error: unmappable character for encoding Cp1252
                                                                "And the only word there spoken was the whispered word, ÔÇ£Lenore?ÔÇ?",

As here seems to be a real bug I would like to see more documentation in this PR, meaning an error log / message. Can you provide one (or is mine a copy of it?)

Especially: Why now? I had the issues on May 1st, but after then never again and obviously nobody else since you got them now? I can't don't want to believe we are the only two win users.

@NPException
Copy link
Contributor Author

@Bukama yes I guess I could have included the error message in the description. 🙈 I'll edit it in.
Here it is as well:

ReportEntryExtensionTests.java:377: error: unmappable character (0x9D) for encoding windows-1252
	"And the only word there spoken was the whispered word, “Lenore?�?",

It's the same as yours, just complaining about a different encoding.

@Bukama Bukama self-requested a review May 29, 2020 19:07
@Bukama
Copy link
Member

Bukama commented May 29, 2020

Thank you for adding the information. I'll merge this PR.

@Bukama Bukama merged commit 4a78417 into junit-pioneer:master May 29, 2020
@NPException NPException deleted the enforce-gradle-utf8-compile-encoding branch May 29, 2020 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants