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

Jacques Le Roux edited comment on OFBIZ-13168 at 11/6/24 4:33 PM:
------------------------------------------------------------------

Should we not rather use IsAlnum in trunk and 24.09 to also handle "Unicode 
characters too"

According to [https://www.regular-expressions.info/posixbrackets.html:]
{quote}In Java 8 and prior, it does not matter whether you use the Is prefix 
with the \p syntax or not. So in Java 8, \p\{Alnum} and \p\{IsAlnum} are 
identical. In Java 9 and later there is a difference. Without the Is prefix, 
the behavior is exactly the same as in previous versions of Java. The syntax 
with the Is prefix now matches Unicode characters too.
{quote}
For IsPunct I'm unsure, but sounds good too:
[https://stackoverflow.com/questions/13925454/check-if-string-is-a-punctuation-character#saves-btn-49289766]


was (Author: jacques.le.roux):
Should we not rather use IsAlnum to also handle "Unicode characters too"

According to https://www.regular-expressions.info/posixbrackets.html:

bq. In Java 8 and prior, it does not matter whether you use the Is prefix with 
the \p syntax or not. So in Java 8, \p{Alnum} and \p{IsAlnum} are identical. In 
Java 9 and later there is a difference. Without the Is prefix, the behavior is 
exactly the same as in previous versions of Java. The syntax with the Is prefix 
now matches Unicode characters too.

For IsPunct I'm unsure, but sounds good too:
https://stackoverflow.com/questions/13925454/check-if-string-is-a-punctuation-character#saves-btn-49289766

> 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