Created
February 14, 2012 07:29
-
-
Save josher19/1824504 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Convert quoted printable text to plain text using QP.decode. */ | |
QP = QuotedPrintable = { | |
decode: function (data) { return unescape(data.replace(/=\r?\n/g, "").replace(/=/g, "%")); } | |
, encode: function (inp) { return this.sliceup( inp.replace(/[^ a-zA-Z0-9:.,<>'";\r\n!-<>-~]/g, function(c) { return escape(c).replace(/%/g, "=") }) ).replace(/ \r?\n/g, "=20\r\n").replace(/\t\r?\n/g, "=09\r\n"); } | |
, sliceup: function (chunk, sz, sep) { sz=(sz-0)||75; var i, res=[], len = chunk.length/sz; for(i=0; i<len; ++i) res[i]=chunk.slice(i*sz, (i+1)*sz); return res.join(sep || "=\n"); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment