eduardtomasek / lz-string-python

lz-string for python 3
Do What The F*ck You Want To Public License
31 stars 42 forks source link

Surrogates Error Decompressing UTF-16 #16

Open wolfxvi opened 5 years ago

wolfxvi commented 5 years ago

Im trying to decompress an api response that is compressed in utf-16 but when i try it i get the following error "UnicodeEncodeError: 'utf-8' codec can't encode character '\udc00' in position 0: surrogates not allowed" (note that the character is not always the same). I researched it and i found that the character is probably an emoji. I tryied to encode and decode the string before the decpmpress with surrogateescape, or surrogatepass with no luck.. Any idea how to fix it?