Re: Strange issue displaying numbers when in Arabic locale

Zoran Avtarovski <[email protected]> Mon, 7 Apr 2025 09:07:24 +1000
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
Thanks Lukasz, Uti,

The issue indeed was how Java treated numbers after Java 8.

After a inordinate amount of searching on how to change the solution was 
to set the locale extension on how to treat numbers.

Instead of just creating a Locale using the language code I used a local 
builder extension to set the number units (NU) as such:

locale = new 
Locale.Builder().setLanguage(localeStr).setExtension(Locale.UNICODE_LOCALE_EXTENSION, 
"nu-latn").build();

This keeps the locale as Arabic/Pashto/etc but forces display of numbers 
in Latin form which is what we needed.

Lukasz, I had a look at your fix and I think by applying the above code 
in the I18N Interceptor in Struts 7 you can treat the issue at the 
source and numbers are displayed correctly.

Z.



The solution we implemented was to  create a custom I18n Interceptor which

On 6/4/2025 2:02 am, Lukasz Lenart wrote:
> sob., 5 kwi 2025 o 02:47 Zoran Avtarovski<[email protected]> napisał(a):
>> <s:set var="qrStatus" value="0"/>
>> <s:hidden name="arrayFormValue[%{#qrStatus}]" value="%{#qrStatus}" />
>> <s:set var="qrStatus" value="%{#qrStatus + 1}"/>
>> <s:hidden name="arrayFormValue[%{#qrStatus}]" value="%{#qrStatus}" />
>>
>> This is likely intended behaviour but I would like to know how we stop
>> it from happening?
> You can try this
> https://stackoverflow.com/questions/77250075/struts-2-and-jdk-17-numbers-in-locale
>
> Based on user request I have implemented such a fix
> https://issues.apache.org/jira/browse/WW-5360
>
> which is the best approach tbh
>
>
> Regards
> Łukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:[email protected]
> For additional commands, e-mail:[email protected]
>