Fixed: Support non-breaking spaces in numeric strings #845
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed: Support non-breaking spaces in numeric strings
(OFBIZ-13168)
Explanation
In forms, numeric fields are represented by an input with type "text", which allows user to enter/paste all characters, including non-breaking spaces ('\u00A0', '\u202F', '\u2007'), like "29 000" (the space is
\u202F
). More specifically, a user can copy/paste a string from an external tool which uses non-breaking spaces as a thousands separator, and expect that a visually correct string will be correctly interpreted by OFBiz.OFBiz uses
java.text.NumberFormat::parse
method, which does not support non-breaking spaces : characters after this kind of spaces are simply ignored, and "29 000" becomes "29".This PR only illustrates the problem and a way of fixing it, I'm not sure that this would be a good solution (maybe handle submitted strings elsewhere ? maybe more upstream ?).
Thanks: Nereide team