1200wd / bitcoinlib

Bitcoin and other Cryptocurrencies Library for Python. Includes a fully functional wallet, Mnemonic key generation and management and connection with various service providers to receive and send blockchain and transaction information.
http://bitcoinlib.readthedocs.io/
GNU General Public License v3.0
596 stars 199 forks source link

Update preferred encoding check #344

Closed Naggafin closed 9 months ago

Naggafin commented 9 months ago

In config/config.py on line 123 and 127, the result of locale.getpreferredencoding() is compared against "UTF-8" with a not equal comparison. This should be updated to be locale.getpreferredencoding() not in ('UTF-8', 'utf-8') instead. I'm not sure if this is a Python-specific change or something with my OS, but after upgrading to Python 3.11, locale.getpreferredencoding() returns the lowercase "utf-8" as opposed to "UTF-8". This is not incorrect, although because bitcoinlib is only checking against the uppercase version, this check fails. Comparing against both would expand bitcoinlib's general usability across Python versions, variations, and operating systems.

mccwdev commented 9 months ago

See https://github.com/1200wd/bitcoinlib/issues/343 This is fixed in https://github.com/1200wd/bitcoinlib/commit/6c82ac40ac66cfec2fd010d7bbcf70d5df46e623