Videos
While upgrading to the Java 17 version using the OpenJDK built by Microsoft, I also ran into problems because the Java source files were now encoded using the default Windows encoding, instead of UTF-8.
To fix the problem, set the file.encoding property to UTF-8.
The easiest way to do it is to set the MAVEN_OPTS environment variable:
MAVEN_OPTS=-Dfile.encoding=UTF-8
Another option is to pass it to the Maven Surefire plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
And, if you want to start a Java program, then pass the -Dfile.encoding=UTF8 property.
Related, but in a different environment than yours...
I had the same issue when upgrading AWS Corretto Java from version 11 to 17, where some of test cases with special characters suddenly started failing after the upgrade.
The fix for me was to add below to the aws codebuild buildspec.yml.
pre_build:
commands:
- dnf -y install glibc-langpack-en
- export LC_ALL="en_US.utf8"