just built a small webapp for previewing HTML-documents that generates URL:s containing the HTML (and all inline CSS and Javascript) in base64 encoded data. Problem is, the URL:s quickly get kinda long. What is the "de facto" standard way (preferably by Javascript) to press the string first without data loss?
PS; I read about Huffman and Lempel-Ziv in school some time ago, and I remember really enjoying LZW :)
EDIT:
Solution found; seems like rawStr => utf8Str => lzwStr => base64Str is the way to go. I'm further working on implementing huffman pression between utf8 and lzw. Problem so far is that too many chars bee very long when encoded to base64.
just built a small webapp for previewing HTML-documents that generates URL:s containing the HTML (and all inline CSS and Javascript) in base64 encoded data. Problem is, the URL:s quickly get kinda long. What is the "de facto" standard way (preferably by Javascript) to press the string first without data loss?
PS; I read about Huffman and Lempel-Ziv in school some time ago, and I remember really enjoying LZW :)
EDIT:
Solution found; seems like rawStr => utf8Str => lzwStr => base64Str is the way to go. I'm further working on implementing huffman pression between utf8 and lzw. Problem so far is that too many chars bee very long when encoded to base64.
Share Improve this question edited Nov 10, 2010 at 21:19 bennedich asked Nov 10, 2010 at 13:01 bennedichbennedich 12.4k6 gold badges35 silver badges42 bronze badges2 Answers
Reset to default 6Check out this answer. It mentions functions for LZW pression/depression (via http://jsolait/, specifically http://jsolait/browser/trunk/jsolait/lib/codecs.js).
You will struggle to get very much pression at all on a URL, they're too short and don't contain enough redundant information to get much benefit from Huffman / LZW style algorithms.
If you have constraints on the space of possible URLS (e.g. all content tends to be in the same set of folders) you could hard code some parts of the URLS for expansion on the client - i.e. cheat.