UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 4: invalid start byte
I encountered a decode error.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 4: invalid start byte
`base string: handet to lib/python3.6/site-packages/simplejson/decoder.py b'eyJjaGlsZHJlbiI6IFtbInBvcnRhbF9faWV4YWN0IiwgIkZsdWVnZV9kZSJdXSwgImNvbm5lY3RvciI6ICJBTkQiLCAibmVnYXRlZCI6IGZhbHNlfQ=='
string decoded b'm\xec\x89\x8d\xa1\xa5\xb1\x91\xc9\x95\xb8\x88\xe8\x81ml\x89\xc1\xbd\xc9\xd1\x85\xb1}}\xa5\x95\xe1\x85\x8d\xd0\x88\xb0\x80\x89\x19\xb1\xd5\x95\x9d\x95}\x91\x94\x89ut\xb0\x80\x89\x8d\xbd\xb9\xb9\x95\x8d\xd1\xbd\xc8\x88\xe8\x80\x89\x059\x10\x88\xb0\x80\x89\xb9\x95\x9d\x85\xd1\x95\x90\x88\xe8\x81\x99\x85\xb1\xcd\x95\xf4'
encode again b'beyJjaGlsZHJlbiI6IFtbInBvcnRhbF9faWV4YWN0IiwgIkZsdWVnZV9kZSJdXSwgImNvbm5lY3RvciI6ICJBTkQiLCAibmVnYXRlZCI6IGZhbHNlfQ=' b'm\xec\x89\x8d\xa1\xa5\xb1\x91\xc9\x95\xb8\x88\xe8\x81ml\x89\xc1\xbd\xc9\xd1\x85\xb1}}\xa5\x95\xe1\x85\x8d\xd0\x88\xb0\x80\x89\x19\xb1\xd5\x95\x9d\x95}\x91\x94\x89ut\xb0\x80\x89\x8d\xbd\xb9\xb9\x95\x8d\xd1\xbd\xc8\x88\xe8\x80\x89\x059\x10\x88\xb0\x80\x89\xb9\x95\x9d\x85\xd1\x95\x90\x88\xe8\x81\x99\x85\xb1\xcd\x95\xf4' `
there is an b and a ' at the start of the submited string. i hotfixed this by
/lib/python3.6/site-packages/advanced_filters/q_serializer.py def loads(self, string, raw=False): string = string.replace('b'','') string = string.replace(''', '') if self.b64_enabled: d = json.loads(base64.b64decode(string)) else: d = json.loads(string) if raw: return d return self.deserialize(d)
@GegX any luck on this? I am facing the same issue too.
The creater of this lib needs to have a Look at this Code. Or you can try to commit a/this solution. Other then this simple replace I have no clue why this occurs or how to solve this in another way
I think, this issues mainly occur when we give name with sign such as =, ),( etc.. to title when we create advance filter. I avoided that and it started working with my project.
Thanks for the feedback guys, I think I missed the original ticket from May.
@GegX if you could provide reproduction instructions step-by-step, or a failing test, it will make it more clear what is expected vs what is actually happening and we could then fix the issue in the best manner possible.