adoptium-support icon indicating copy to clipboard operation
adoptium-support copied to clipboard

Invalid minus sign in DecimalFormatSymbols for "hr" locale

Open mnorsic opened this issue 2 years ago • 2 comments

Please provide a brief summary of the bug

Recently I have upgraded Java from 11 to 17, and while running some unit tests, I have discovered that minus sign is not as expected (standard character '-' which is ASCII decimal value 45 or 0x2d), but some weird hex character 0x2212.

I'm running Temurin 17.0.6 both on Windows 11 and in WSL, and I see the same behavior on both versions.

Please provide steps to reproduce where possible

var locale = new java.util.Locale("hr");
var sym = java.text.DecimalFormatSymbols.getInstance(locale);
var minusSign = Integer.toHexString(sym.getMinusSign());  // equals to "2212" instead of "2d"

Expected Results

Minus sign should be mapped correctly to 2d, or ASCII 45.

Actual Results

DecimalFormatSymbols.getInstance() for "hr" locale returns non-ASCII minus sign that equals to 0x2212.

What Java Version are you using?

openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)

What is your operating system and platform?

Windows 11, x64 architecture, WSL 2

How did you install Java?

SDKMan in WSL, MSI installer on Windows

Did it work before?

Worked correctly on Java 8 and 11

Did you test with the latest update version?

Yes

Did you test with other Java versions?

On Windows 11, I have tried with
openjdk 17.0.3 2022-04-19
OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06)
OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 17.0.3+7-jvmci-22.1-b06, mixed mode, sharing)

Relevant log output

No response

mnorsic avatar Feb 14 '23 15:02 mnorsic

Reported upstream here: https://bugs.openjdk.org/browse/JDK-8302552

jerboaa avatar Feb 15 '23 11:02 jerboaa

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

github-actions[bot] avatar May 17 '23 00:05 github-actions[bot]