Closed dadokkio closed 1 year ago
I have been looking at this.. just not sure if the fix will cause any other issues. Needs a bit more testing.
Pushed up a change that should address this issue
The fix is not working;
>>> decode( encode(urandom(16), "hex"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/rtb/libs/StringCoding.py", line 57, in decode
rv, length = codec.decode(s, *args, **kwargs)
File "/usr/local/lib/python3.8/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 0: invalid start byte
A way found to convert it to string is using codecs:
>>> codecs.decode( encode(urandom(16), "hex"), errors='replace')
'\x07��ϔ1�=?��\u05f9r�\x0f'
Not sure it is what you ar looking for, at least it is a string :)
Now it works!
Box created:
And garbage doesn't cause issue anymore:
The code to generate garbage field in box model returns a bytes string
Storing this data in postgres causes error:
The value that it wants to save in the db is
\x6439613663616530336463373030656535326632653361616531643139353866
obtained changing garbage field size to 200char