dozingcat / Vector-Pinball-Editor

GUI editor for Vector Pinball
GNU General Public License v3.0
26 stars 10 forks source link

fix number format issues in locales other than US #23

Closed wbommel closed 6 months ago

wbommel commented 7 months ago

In my case (localated in germany Locale.DE) using DecimalFormat("#.######") (in JsonPrettyPrinter.java) lead to the use of comma as decimal delimiter destroying the JSON like so: image original --> image with comma

Easy fix was to use NumberFormat.getInstance(Locale.US) according to https://www.baeldung.com/java-8-localization so I created a pull-request for it.

Not being "at home" in Java I cannot say if it might have side effects, so please take a closer look. ;-)

dozingcat commented 6 months ago

Good find, thanks! Fixed in #24; I used DecimalFormatSymbols to keep the same format, since NumberFormat.getInstance outputs fewer decimal places.

wbommel commented 6 months ago

Perfect, thanks for fixing. :-)