bitcoin-labs / bitcoin-mobile-android

http://bitcoin-labs.github.com/bitcoin-mobile-android
Apache License 2.0
30 stars 6 forks source link

DecimalFormat mismatch on non-english locales #19

Closed openintents closed 13 years ago

openintents commented 13 years ago

Scaning the QR-code with amount 0.5 on http://bitcoin-labs.github.com/bitcoin-mobile-android/uriScheme.html with a device with non-english locale , e.g. German fails as the amount is formated with "," instead of "." The latter is expected from the parser.

06-07 22:19:49.500: ERROR/AndroidRuntime(4835): java.lang.RuntimeException: invalid amount string: 0,05 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at com.bitcoinlabs.android.MoneyUtils.btcStringToSatoshis(MoneyUtils.java:54) 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at com.bitcoinlabs.android.ConfirmPay$1.onClick(ConfirmPay.java:79) 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at android.view.View.performClick(View.java:2485) 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at android.view.View$PerformClick.run(View.java:9080) 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at android.os.Handler.handleCallback(Handler.java:587) 06-07 22:19:49.500: ERROR/AndroidRuntime(4835): at android.os.Handler.dispatchMessage(Handler.java:92)

FIX: add new DecimalFormatSymbols(Locale.ENGLISH) in MoneyUtils.java (54)

andrewschaaf commented 13 years ago

Thanks! We'll include that in the overhaul this weekend.

openintents commented 13 years ago

I pushed the change in MoneyUtils.