jgarzik / python-bitcoinrpc

Python interface to bitcoin's JSON-RPC API
GNU Lesser General Public License v2.1
644 stars 304 forks source link

fixed unicode serialisation #27

Open toyg opened 10 years ago

toyg commented 10 years ago

unicode characters in arguments get mangled up. Tested in Python 3.3.3 only.

toyg commented 10 years ago

Works fine in 2.5+ as well. Should be safe to merge :)

thedod commented 10 years ago

I was just about to pull request the same: 666d96a2cea :laughing:. Anyway, :+1:

luke-jr commented 9 years ago

Hmm, this doesn't seem to actually fix the issue, just avoids the infinite loop. In particular, by casting to a float you're not ensuring the Decimal value gets encoded correctly (with 8 decimal places). I think fixing this properly will require subclassing JSONEncoder - no need to round the value, though, just get it included precisely.