-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathREADME
10 lines (10 loc) · 827 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
str argument should be a binary-string like result of readAsBinaryString from HTML5 FileAPI
Actually, javascript implementations uses utf-16(LE) for internal representation of strings
if you want to transfer data over http, keep in mind encoding, used at your server
for example, if you use bzcompress in php, it will return iso-latin-1 encoded string
and if your server uses utf-8, you'll need to utf8_encode result before output
or set proper encoding http header
Moreover, if you transfer bzipped utf8 texts, you'll need to transform the result of bzip2-decoding in js
Even though escape/unesapce functions are considered deprecated, I would advise the following code
function utf8_decode(str) { return decodeURIComponent(escape(str)); }
cause it have most balanced execution time across different browsers and input strings