无损COM pression方法来缩短字符串base64编码前,把它缩短? [英] Lossless compression method to shorten string before base64 encoding to make it shorter?

查看:884
本文介绍了无损COM pression方法来缩短字符串base64编码前,把它缩短?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚建立了一个小型的Web应用程序生成的URL previewing HTML的文件:S包含HTML(和所有联CSS和Javascript)以base64 EN codeD数据。问题是,网址:■快速获得还挺长。什么是事实上的标准方式(preferably通过的的JavaScript ),以COM preSS字符串第一个无数据丢失?

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;我前段时间读到霍夫曼和的Lempel-谢夫在学校里,我记得我真的很享受LZW:)

PS; I read about Huffman and Lempel-Ziv in school some time ago, and I remember really enjoying LZW :)

编辑:

解决方案中;好像rawStr => utf8Str => lzwStr => base64Str是要走的路。我还正在实施UTF8和LZW之间霍夫曼COM pression。问题至今是过多的字符成为连接codeD为base64时很长。

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.

推荐答案

查看这个答案。它通过 http://jsolait.net/ 提到了LZW COM pression / DECOM pression(功能,特别是<一个href=\"http://jsolait.net/browser/trunk/jsolait/lib/$c$ccs.js\">http://jsolait.net/browser/trunk/jsolait/lib/$c$ccs.js).

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).

这篇关于无损COM pression方法来缩短字符串base64编码前,把它缩短?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆