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

useMavenLogger breaks nōn-ASCII characters (i.e. 99.9̅% of Unicode) #158

Closed
mirabilos opened this issue Jun 21, 2020 · 6 comments · Fixed by #372
Closed

useMavenLogger breaks nōn-ASCII characters (i.e. 99.9̅% of Unicode) #158

mirabilos opened this issue Jun 21, 2020 · 6 comments · Fixed by #372
Labels

Comments

@mirabilos
Copy link

mirabilos commented Jun 21, 2020

I saw this in one of my scripts, but I reduced the script to just…

#!/bin/sh
echo mäh
exit 0

… for the reproduction of this.

$ mvn org.codehaus.mojo:exec-maven-plugin:exec@build-depsrcs@build-depsrcs -Dexec.useMavenLogger=false
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< org.evolvis.tartools:csvfile >--------------------
[INFO] Building org.evolvis.tartools:csvfile 3.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (build-depsrcs) @ csvfile ---
mäh
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.262 s
[INFO] Finished at: 2020-06-21T17:48:46+02:00
[INFO] ------------------------------------------------------------------------

… vs…

$ mvn org.codehaus.mojo:exec-maven-plugin:exec@build-depsrcs@build-depsrcs -Dexec.useMavenLogger=true
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< org.evolvis.tartools:csvfile >--------------------
[INFO] Building org.evolvis.tartools:csvfile 3.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- exec-maven-plugin:3.0.0:exec (build-depsrcs) @ csvfile ---
[INFO] [main] mᅢᄂh
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.685 s
[INFO] Finished at: 2020-06-21T17:49:00+02:00
[INFO] ------------------------------------------------------------------------

Watch it completely destroy the umlaut.

IMHO, the conversion between script output and string passed to the logger SHOULD use the locale encoding, and if that is not possible or ASCII, it MUST use UTF-8.

Cc @hankolerd

@mirabilos
Copy link
Author

The wide characters in question are U+FFC3 and U+FFA4, which is what happens when you use the line encoding of UTF-8 (\xC3\xA4), read it byte-for-byte and (wrong) sign-extend it to Unicode.

@hankolerd

jebeaudet added a commit to jebeaudet/exec-maven-plugin that referenced this issue Jun 21, 2023
jebeaudet added a commit to jebeaudet/exec-maven-plugin that referenced this issue Jun 21, 2023
@mirabilos
Copy link
Author

Which version contains the fix? (From a user’s PoV, it’s better to keep bugreports open until they can actually install a fixed version.)

But thanks for fixing it.

@jebeaudet
Copy link
Contributor

@mirabilos It has been released in 3.1.1

@mirabilos
Copy link
Author

OK.

As a testcase, trying to write a latin-1 mäh first, then a UTF-8 mäh.

With LC_ALL=C.UTF-8:

[INFO] m�h
[INFO] mäh

With LC_ALL=C:

[INFO] m?h
[INFO] m??h

So it’s definitely interpreting the bytes into wide characters then converting them back to current-locale multibyte characters. This is precisely the follow-up bug I already warned about… but it’s an improvement from the situation before, at least.

@jebeaudet
Copy link
Contributor

As Slawomir said, comments on commits are easily missed, I never saw that thread.

As for the issue, I'll repeat what he said that you can do a PR with a tentative fix.

@slawekjaranowski
Copy link
Member

Hi - this issue is also closed .... so if something is still wrong please:

  • create new issue with description and better reproduce steps
  • create PR with fix proposition

comments with closed issue can also be missed

dongjoon-hyun pushed a commit to apache/spark that referenced this issue Apr 16, 2024
### What changes were proposed in this pull request?

### Why are the changes needed?
- `exec-maven-plugin` from `3.1.0` to `3.2.0`
https://github.com/mojohaus/exec-maven-plugin/releases/tag/3.2.0
https://github.com/mojohaus/exec-maven-plugin/releases/tag/3.1.1
Bug Fixes:
1.Fix mojohaus/exec-maven-plugin#158 - Fix non ascii character handling (mojohaus/exec-maven-plugin#372)
2.[mojohaus/exec-maven-plugin#323] exec arguments missing (mojohaus/exec-maven-plugin#324)

- `build-helper-maven-plugin` from `3.4.0` to `3.5.0`
https://github.com/mojohaus/build-helper-maven-plugin/releases/tag/3.5.0

- `maven-compiler-plugin` from `3.12.1` to `3.13.0`
https://github.com/apache/maven-compiler-plugin/releases/tag/maven-compiler-plugin-3.13.0

- `maven-jar-plugin` from `3.3.0` to `3.4.0`
https://github.com/apache/maven-jar-plugin/releases/tag/maven-jar-plugin-3.4.0
[[MJAR-62]](https://issues.apache.org/jira/browse/MJAR-62) - Set Build-Jdk according to used toolchain (apache/maven-jar-plugin#73)

- `maven-source-plugin` from `3.3.0` to `3.3.1`
https://github.com/apache/maven-source-plugin/releases/tag/maven-source-plugin-3.3.1

- `maven-assembly-plugin` from `3.6.0` to `3.7.1`
https://github.com/apache/maven-assembly-plugin/releases/tag/maven-assembly-plugin-3.7.1
https://github.com/apache/maven-assembly-plugin/releases/tag/maven-assembly-plugin-3.7.0
Bug Fixes:
1.[[MASSEMBLY-967](https://issues.apache.org/jira/browse/MASSEMBLY-967)] - maven-assembly-plugin doesn't add target/class artifacts in generated jarfat but META-INF/MANIFEST.MF seems to be correct
2.[[MASSEMBLY-994](https://issues.apache.org/jira/browse/MASSEMBLY-994)] - Items from unpacked dependency are not refreshed
3.[[MASSEMBLY-998](https://issues.apache.org/jira/browse/MASSEMBLY-998)] - Transitive dependencies are not properly excluded as of 3.1.1
4.[[MASSEMBLY-1008](https://issues.apache.org/jira/browse/MASSEMBLY-1008)] - Assembly plugin handles scopes wrongly
5.[[MASSEMBLY-1020](https://issues.apache.org/jira/browse/MASSEMBLY-1020)] - Cannot invoke "java.io.File.isFile()" because "this.inputFile" is null
6.[[MASSEMBLY-1021](https://issues.apache.org/jira/browse/MASSEMBLY-1021)] - Nullpointer in assembly:single when upgrading to 3.7.0
7.[[MASSEMBLY-1022](https://issues.apache.org/jira/browse/MASSEMBLY-1022)] - Unresolved artifacts should be not processed

- `cyclonedx-maven-plugin` from `2.7.9` to `2.8.0`
https://github.com/CycloneDX/cyclonedx-maven-plugin/releases/tag/cyclonedx-maven-plugin-2.8.0
https://github.com/CycloneDX/cyclonedx-maven-plugin/releases/tag/cyclonedx-maven-plugin-2.7.11
https://github.com/CycloneDX/cyclonedx-maven-plugin/releases/tag/cyclonedx-maven-plugin-2.7.10
Bug Fixes:
1.check if configured schemaVersion is supported (CycloneDX/cyclonedx-maven-plugin#479)
2.ignore bomGenerator.generate() call (CycloneDX/cyclonedx-maven-plugin#376)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #46043 from panbingkun/update_maven_plugins.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants