-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Description:
When validating numbers using NumberTranslator with French locale
incorrect parsing of a user entered decimal occurs. Example, 55 000
results in a String value of 55 being returned by NumberTranslator.
Reason being that the user enters a space (0x20) as the grouping
separator, however, java.text.DecimalFormat expects a non-breaking space
(0xA0). The tranlsator should replace grouping separator spaces with
non-breaking spaces?
I see three possible approaches if this issue is to be resolved with the
following base: NumberTranslator extends FormatTranslator
1. Reimplement FormatTranslator's parseText in NumberTranslator and
replace 0x20 with 0xA0 prior to parsing then complete the parse.
Pro: Single place for number translation
Con: Duplicates parent object's method
Either the replacement would be for all locales or logic
necessary to determine which ones needed the replacement. Not sure what
this would do to other locales if global replacement.
2. Add empty protected method to FormatTranslator which is called prior
to text parsing. Implement this method in NumberTranslator
Pro: No need to duplicate method
Simple method to implement in individual translators if
necessary (initially only NumberTranslator
Con: Do-nothing method for most scenarios in parent class
Still need logic in NumberTranslator to determine which locales
need special treatment or replacement would be for all locales. Still
not sure what this would do for other locales if global replacement.
3. Extend NumberTranslator to FrenchNumberTranslator
Pro: Definitely isolates the issue
Con: Just seems... overkill? wrong?
I haven't touched the code - just looking over issue.
Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
iD8DBQFEFmksaCoPKRow/gARAgzlAJ0dS04uAjdIIo+Pio4i1bWtVQs/lwCgpLcK
2IBru3hiyGnOvbyGSRBTMik=
=tROY
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]