janiko71 / boxcryptor-decryptor

File decryption for Boxcryptor in Python 3
GNU General Public License v3.0
16 stars 5 forks source link

Decode crypto_json_txt to UTF8 #1

Closed MikeBergmann closed 4 years ago

MikeBergmann commented 4 years ago

The JSON contains a name element containing the filename which is encoded as UTF8. Having non-ASCII characters in there will produce a TypeError: the JSON object must be str, not 'bytes'.

janiko71 commented 4 years ago

Hi Mike, thank you for contributing! This addition is not needed with the most recent versions of Python (>=3.6): the json content can be deserialized in str or bytes format. Here, the content is in binary format (bytes), so the deserialization works fine, even with unicode characters. I made some tests with russian and japanese characters, encrypted with Boxcryptor, and got no error. This python project is not intended to be industrial-grade with support of multiple versions of Python, and I can't assert that this modification would be enough to ensure backward compatibility.

MikeBergmann commented 4 years ago

Hi Jean, thanks for coming back to me. Very appreciated. Yes, you are right. With Python 3.8 it is working out of the box. Therefore I close this one.

Kind regards

Mike