Really simple short string compression

后端 未结 9 1309
感动是毒
感动是毒 2020-12-01 16:21

Is there a really simple compression technique for strings up to about 255 characters in length (yes, I\'m compressing URLs)?

I am not concerned with the strength o

9条回答
  •  不知归路
    2020-12-01 16:26

    You can use deflate algorithm directly, without any headers checksums or footers, as described in this question: Python: Inflate and Deflate implementations

    This cuts down a 4100 character URL to 1270 base64 characters, in my test, allowing it to fit inside IE's 2000 limit.

    And here's an example of a 4000-character URL, which can't be solved with a hashtable since the applet can exist on any server.

提交回复
热议问题