jayendra13 / simpleubjson

Automatically exported from code.google.com/p/simpleubjson
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Exception when encoding non-UTF8 bytestrings in python3 (and possibly python2) #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Clone https://github.com/brainwater/simpleubjsonerror
2. follow the instructions in the readme

Alternatively:
1. create a long random bytestring (e.g. with os.urandom(30)), specifically a 
bytestring that is not valid UTF8
2. Encode that bytestring with simpleubjson

What is the expected output? What do you see instead?
The expected result is for simpleubjson to encode and then decode the 
dictionary containing the bytes properly. Instead, it raises an exception due 
to the bytestring not being valid utf8 bytes.

What version of the product are you using? On what operating system?
simnpleubjson 0.7.0 on debian testing (stretch) with python3.

Please provide any additional information below.

I tried it with python2 and it seems to also fail in python2.
I am using simpleubjson for encoding metadata for an encryption utility, and 
the random keys are not valid UTF8, so I have to convert the keys into integer 
arrays. See https://github.com/brainwater/rivercrypt

Original issue reported on code.google.com by Rainwate...@gmail.com on 16 Aug 2015 at 10:43

Attachments: