Open nilp0inter opened 9 years ago
Unfortunately, this is still the case.
To save others some googling time, this is the error you'll get:
Traceback (most recent call last):
File "lzstring.py", line 6, in <module>
decoded = x.decompressFromBase64(data)
File "/Users/grischard/code/lzstring/venv/lib/python3.6/site-packages/lzstring/__init__.py", line 685, in decompressFromBase64
return self.decompress(output)
File "/Users/grischard/code/lzstring/venv/lib/python3.6/site-packages/lzstring/__init__.py", line 563, in decompress
data_val = ord(data_string[data_index])
IndexError: string index out of range
I had the same issues with newer versions of lz-string, so I made a new Python 3 version https://github.com/marcel-dancak/lz-string-python
Hi,
because of changes made in the encoding method of lz-string(https://github.com/pieroxy/lz-string/commit/2d5a419620ba0d9f6d2a046224f518a485caae3a), the javascript version can produce strings that can't be decompressed with this version.
This example raise an IndexError:
If anyone is interested I've found this https://github.com/pieroxy/lz-string/blob/0dda98caa06c4c09e251a96378538169dfbc5a5f/libs/lz-string.js as the last version compatible.