Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  59] [ 4]  / answers: 1 / hits: 25354  / 14 Years ago, wed, november 10, 2010, 12:00:00

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 compress 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 compression between utf8 and lzw. Problem so far is that too many chars become very long when encoded to base64.


More From » compression

 Answers
37

Check out this answer. It mentions functions for LZW compression/decompression (via http://jsolait.net/, specifically http://jsolait.net/browser/trunk/jsolait/lib/codecs.js).


[#95025] Sunday, November 7, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marib

Total Points: 596
Total Questions: 120
Total Answers: 95

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
;