DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21992>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21992

Localized number formatting inconsistency

           Summary: Localized number formatting inconsistency
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


There is an issue with the current implementation of the <bean:write> tag. If
the pattern is specified directly in the "format" attribute, the decimal symbols
expected are the english symbols ("." as the decimal separator, and "," as the
grouping separator) but the number is actually properly formated according to
the current locale. For example :

    <bean:write name="value" format="#,000.00"/>

will give under a french locale something like : 

    1 234,00

So far it's ok. Now if the format pattern is moved into the resource bundle :

    format.pattern=#,000.00

and the tag is changed accordingly :

    <bean:write name="value" formatKey="format.pattern"/>

the result is different :

    1234,00000.

The pattern has been parsed with the french decimal symbols ("," stands for the
decimal separator), the dot "." is not recognized and pushed at the end of the
string, five 0 are enforced after the decimal separator.

One could expect that the pattern is handled the same way in both cases. This
issue is caused by the call to DecimalFormat.applyLocalizedPattern() instead of
applyPattern() in the WriteTag class if the "formatKey" attribute is specified.
Of course using the localized symbols in the resource bundle could fix this
issue, but they are not well documented and difficult to guess (i have yet to
figure the grouping separator for the french locale, a simple white space won't
work). There is no advantage in using applyLocalizedPattern instead of
applyPattern, the number is still localized properly with a pattern in the
english notation.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to