RubyMoney / google_currency

Ruby Money::Bank interface for the Google Currency exchange data
http://rubymoney.github.com/google_currency
MIT License
182 stars 90 forks source link

IDR: ArgumentError: invalid byte sequence in UTF-8 #16

Closed dblock closed 11 years ago

dblock commented 11 years ago
require 'money'
require 'money/bank/google_currency'
require 'json'
MultiJson.engine = :json_gem
Money.default_bank = Money::Bank::GoogleCurrency.new
n = 1.to_money(:USD)
n.exchange_to(:IDR)
ArgumentError: invalid byte sequence in UTF-8
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:140:in `match'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:140:in `match'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:140:in `complex_rate?'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:126:in `decode_rate'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:85:in `fetch_rate'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:64:in `block in get_rate'
    from <internal:prelude>:10:in `synchronize'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/google_currency-2.2.0/lib/money/bank/google_currency.rb:63:in `get_rate'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/money-5.1.1/lib/money/bank/variable_exchange.rb:90:in `exchange_with'
    from /Users/dblock/.rvm/gems/ruby-1.9.3-p385/gems/money-5.1.1/lib/money/money.rb:427:in `exchange_to'
    from (irb):20
    from /Users/dblock/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in `<main>'

Having hard time reproducing this in a spec ...

dblock commented 11 years ago

Fixed in https://github.com/RubyMoney/google_currency/pull/17.