adoptium / adoptium/adoptium-support

Invalid minus sign in DecimalFormatSymbols for "hr" locale

Open
#709 2 comments 0 reactions 0 assignees View on GitHub
bug jbs:reported keep
Dominant language
No language data
Stars
59
Forks
13
PR merge metrics
No merged PRs in 30d

Description

### 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?

```Shell
Worked correctly on Java 8 and 11
```

### Did you test with the latest update version?

```Shell
Yes
```

### Did you test with other Java versions?

```Shell
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_

Contributor guide

Open the contributing guide

Research direction

Start with the provided DecimalFormatSymbols reproduction for the "hr" locale and compare its minusSign result across Java 8, 11, and 17. Trace the locale data or implementation responsible for the change; done means the Croatian locale returns the expected ASCII hyphen and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
internationalization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.