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

ANSI Encoding with Umlauts leads to compile errors and javadoc errors #108

Closed
HoffmannTom opened this issue May 31, 2022 · 8 comments · Fixed by #113
Closed

ANSI Encoding with Umlauts leads to compile errors and javadoc errors #108

HoffmannTom opened this issue May 31, 2022 · 8 comments · Fixed by #113
Labels
type: bug Something isn't working
Milestone

Comments

@HoffmannTom
Copy link

HoffmannTom commented May 31, 2022

Describe the bug
When compiling with Java 17 I get errors due to encoding issues, e.g.:

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ jollyday-jaxb ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 44 source files to E:\EBS\jollyday-0.7.1\jollyday-jaxb\target\classes
[ERROR] /E:/EBS/jollyday-0.7.1/jollyday-jaxb/target/generated-sources/jaxb/de/focus_shift/jaxb/mapping/HolidayType.java:[4,4] unmappable character (0xC4) for encoding UTF-8
[ERROR] /E:/EBS/jollyday-0.7.1/jollyday-jaxb/target/generated-sources/jaxb/de/focus_shift/jaxb/mapping/HolidayType.java:[16,20] unmappable character (0xFC) for encoding UTF-8

The problems are the used Umlauts within the Java files.

To Reproduce
Steps to reproduce the behavior:

  1. Download current release 0.7.1
  2. Compile with Java 17 using the documented command

Expected behavior
Compile shouldn't fail.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Win19
  • Java 17 Coretto

Additional context
Similar problems occur when generating the javadocs. The Umlauts also causes errors.
Maybe converting everything to UTF-8 would be a good solution for the future or omit special characters.

@derTobsch
Copy link
Contributor

Hey @HoffmannTom,
thanks for your issue. I tried to recreate this here https://github.com/focus-shift/jollyday/runs/6684578321?check_suite_focus=true based in windows and java 17. I cannot see any of these errors. Could you take a look at it? Maybe something differs.

@HoffmannTom
Copy link
Author

HoffmannTom commented Jun 1, 2022

hm... I updated to the same java version and also used git clone instead of downloading the zip file.
It looks like there are different default charactersets used on github.
Maybe it would be better to specify the charset of the source files via the parameter "-encoding" and thus being independent of the platform default.
javadoc
I also see that the default charset differs by OS and OS language:
https://stackoverflow.com/questions/9312816/platforms-default-charset-on-different-platforms
On my system, UTF-8 seems to be the default but the java files are ANSI encoded.

@HoffmannTom
Copy link
Author

Btw... the same problem occurs at compiling the java sources:

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ jollyday-jaxb ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 44 source files to E:\EBS\jollyday\jollyday-jaxb\target\classes
[ERROR] /E:/EBS/jollyday/jollyday-jaxb/target/generated-sources/jaxb/de/focus_shift/jaxb/mapping/EthiopianOrthodoxHoliday.java:[4,4] unmappable character (0xC4) for encoding UTF-8
[ERROR] /E:/EBS/jollyday/jollyday-jaxb/target/generated-sources/jaxb/de/focus_shift/jaxb/mapping/EthiopianOrthodoxHoliday.java:[18,20] unmappable character (0xFC) for encoding UTF-8

Using the -encoding parameter would also help to get platform independent:
https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html
Thanks in advance!

@HoffmannTom
Copy link
Author

HoffmannTom commented Jun 1, 2022

Hello @derTobsch
short update:
I changed the pom.xml with:
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
It compiles successfully after this change.

Currently there is UTF-8 configured.
When I clone the project, the Umlauts are ANSI encoded (single-byte) but UTF-8 is multibyte.
Could you check, whether your sources are UTF-8 or ANSI encoded?
Somehow there is currently a mismatch when I clone the repo.

Thanks!

@derTobsch
Copy link
Contributor

derTobsch commented Jun 1, 2022

Intellij says that everything is UTF-8 encoded. By builds are fine. This is also the preferred way to configure it, see https://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html. Need some time to look at it. Maybe you can take a look at your IDE? Maybe there is something wrong? Or do you build it on a shell?

@HoffmannTom can you check your git encoding? Maybe there is something configured.

I also provided two branches. Please clone the repo for each branch again and try to build #112 and #111

@HoffmannTom
Copy link
Author

Hello @derTobsch ,
I just saw that all files with encoding issues are in the subfolders of "jollyday-jaxb/target/generated-sources/"
So the generation of these files seems to happen with the wrong encoding in my case.
Any option to configure the encoding to utf-8 ?

@HoffmannTom
Copy link
Author

HoffmannTom commented Jun 1, 2022

I think I got it
I changed the pom.xml within the jaxb folder:

              <jvmArguments>
                <jvmArgument>-Xms32m</jvmArgument>
		<jvmArgument>-Dfile.encoding=UTF-8</jvmArgument>
              </jvmArguments>

This worked for me.

@derTobsch
Copy link
Contributor

I think I got it I changed the pom.xml within the jaxb folder:

              <jvmArguments>
                <jvmArgument>-Xms32m</jvmArgument>
		<jvmArgument>-Dfile.encoding=UTF-8</jvmArgument>
              </jvmArguments>

This worked for me.

That sounds good. If you want to provide a pr, please feel welcome to provide one. I would be happy to see the first pr from another person ☺️

@derTobsch derTobsch added this to the 0.8.0 milestone Jun 1, 2022
@derTobsch derTobsch added the type: bug Something isn't working label Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants