Issue1914

classification
Title: Float formatting broken in many non-English locales in Jython 2.7
Type: Severity: normal
Components: Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: Arfrever, fwierzbicki
Priority: normal Keywords:

Created on 2012-06-09.19:04:07 by Arfrever, last changed 2012-07-13.21:51:20 by Arfrever.

Messages
msg7197 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-06-09.19:04:06
Float formatting is broken in many non-English locales in Jython 2.7. It is a regression.

The last command prints "1,000000" instead of "1.000000":
$ export LC_ALL="pl_PL.UTF-8"
$ python2.5 -c 'print("%f" % 1.0)'
1.000000
$ python2.7 -c 'print("%f" % 1.0)'
1.000000
$ jython2.5 -c 'print("%f" % 1.0)'
1.000000
$ jython2.7 -c 'print("%f" % 1.0)'
1,000000
$
msg7283 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-29.19:33:44
Arfrever: Do you know of a straightforward way to enable pl_PL.UTF-8 ?

I have tried working with locale-gen as described here: http://askubuntu.com/questions/76013/how-do-i-add-locale-to-ubuntu-server

but it doesn't seem to do the trick :(
msg7284 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-29.19:34:27
BTW I always get this:

bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF8)
msg7285 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-29.19:44:34
OK got it reproduced - my next question: Is 1,00000 correct for pl_PL? In other words, is this a bug in our support of pl_PL or of compatibility with CPython?
msg7287 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-29.21:40:48
For my near future TODO:

I can't apply this just now (working on something else) -- but the solution is simple - in PyString I need to do this:

-            template = new DecimalFormat("#,##0.#####");
+            template = new DecimalFormat("#,##0.#####", new DecimalFormatSymbols(java.util.Locale.US));
msg7312 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-07-13.18:09:06
Fixed in default branch.
msg7314 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-07-13.20:47:06
http://hg.python.org/jython/rev/32bdf218eb0f
msg7318 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-07-13.21:51:20
http://hg.python.org/jython/rev/940d38d23c83
History
Date User Action Args
2012-07-13 21:51:20Arfreversetmessages: + msg7318
2012-07-13 20:47:06Arfreversetmessages: + msg7314
2012-07-13 18:09:07fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg7312
2012-06-29 21:40:49fwierzbickisetmessages: + msg7287
2012-06-29 19:44:34fwierzbickisetmessages: + msg7285
2012-06-29 19:34:27fwierzbickisetmessages: + msg7284
2012-06-29 19:33:44fwierzbickisetmessages: + msg7283
2012-06-29 18:14:34fwierzbickisetpriority: normal
assignee: fwierzbicki
nosy: + fwierzbicki
2012-06-09 19:04:07Arfrevercreate