[ 
https://issues.apache.org/jira/browse/OFBIZ-13168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895907#comment-17895907
 ] 

Jacques Le Roux edited comment on OFBIZ-13168 at 11/7/24 3:04 PM:
------------------------------------------------------------------

-Sorry for the mess. As I missed to put the commit message in the 1st push, I 
supposed that by reverting and reverting again, with PR creations, and putting 
the message in the last push it will be in the commit. It did not. Seems GH is 
not able to do that, or I missed smthg. Even the title I put with the push was 
not. Anyway closing now.
-
I still don't understand why it did not show in this Jira. Here is what I found 
in the git log on my machine:
{quote}SHA-1: f41e0a39bd8878a1f0b6166d5f1eae8ad15ae4ff
 * Fixed: Support non-breaking spaces in numeric strings (OFBIZ-13168) (#847)

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
{quote}


was (Author: jacques.le.roux):
Sorry for the mess. As I missed to put the commit message in the 1st push, I 
supposed that by reverting and reverting again, with PR creations, and putting 
the message in the last push it will be in the commit. It did not. Seems GH is 
not able to do that, or I missed smthg. Even the title I put with the push was 
not. Anyway closing now.

> String to numeric conversion does not support non-breaking spaces
> -----------------------------------------------------------------
>
>                 Key: OFBIZ-13168
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13168
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ALL COMPONENTS
>    Affects Versions: 18.12.16, Upcoming Branch
>            Reporter: Florian Motteau
>            Assignee: Jacques Le Roux
>            Priority: Minor
>             Fix For: Upcoming Branch
>
>         Attachments: Peek 05-11-2024 10-59.mp4, 
> image-2024-11-05-11-01-13-030.png
>
>
> When submitting a form with numeric values, OFBiz uses a text input (`<input 
> type="text"/>`), so all characters (entered by hand or pasted) are allowed in 
> the input.
> On form's submission, for numeric fields, the string is parsed using 
> `java.text.NumberFormat` class (parse method), using a number instance 
> formatter.
> This formatter does not supports non-breaking spaces ('\u00A0', '\u202F', 
> '\u2007'), and characters after a non-breaking space are ignored :
> !image-2024-11-05-11-01-13-030.png|width=337,height=153!
> This can lead to a situation where a visually correct form stores wrong 
> values :
> [^Peek 05-11-2024 10-59.mp4]
> One of our client reported this situation while pasting values from external 
> tools. Some values where truncated, because the external tool used 
> non-breaking spaces when displaying values.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to