jamesfredley opened a new pull request, #15475: URL: https://github.com/apache/grails-core/pull/15475
## Summary - Normalizes `DecimalFormatSymbols.minusSign` to ASCII hyphen-minus (`U+002D`) before formatting negative numbers in GSP tag libraries - Fixes locales like Norwegian (`nb-NO`) that use Unicode minus (`U+2212`), which breaks HTML `<input type="number">` fields ## Problem Some locales (e.g., Norwegian `nb-NO`, Swedish `sv-SE`) use the Unicode minus sign `U+2212` instead of the standard ASCII hyphen-minus `U+002D` when formatting negative numbers via `DecimalFormat`. HTML number input fields expect ASCII minus, causing invalid values and form submission failures. ## Changes ### Source fixes (3 files) - **`FormatTagLib.groovy`** - Normalize minus sign before `decimalFormat.format()` and in `ArithmeticException` fallback path - **`ValidationTagLib.groovy`** - Set `dcfs.minusSign = '-' as char` after `DecimalFormatSymbols` creation in `formatValue()` - **`FormFieldsTagLib.groovy`** - Add `DecimalFormat`/`DecimalFormatSymbols` imports and normalize minus sign in `getNumberFormatter()` ### Tests added (3 files, 5 new tests) - **`FormatTagLibTests.groovy`** - 3 JUnit tests: negative `int`, `Long`, and `BigDecimal` with `nb_NO` locale - **`FormatTagLibSpec.groovy`** - 1 Spock test: `formatNumber` with Norwegian locale - **`ValidationTagLibSpec.groovy`** - 1 Spock test: `g:fieldValue` with Norwegian locale All new and existing tests pass. Fixes #15178 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
