marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

jsref_unescape can not decode chinese word #280

Open fewiki opened 6 years ago

fewiki commented 6 years ago

The unescape() function was deprecated in JavaScript version 1.5. Use decodeURI() or decodeURIComponent() instead.

The unescape() function decodes an encoded string.

https://www.w3schools.com/jsref/jsref_unescape.asp

Can you update the lib? change the unescape function. thanks~~

// in cookieStore.js
function read(key) {
    if (!key || !_has(key)) { return null }
    var regexpStr = "(?:^|.*;\\s*)" +
        escape(key).replace(/[\-\.\+\*]/g, "\\$&") +
        "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"
    return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"))
}
jerdeboer commented 6 years ago

Any chance explaining how you got around this, the values in local storage are all in Chinese Characters

iongion commented 6 years ago

I am having the same issue, I initially thought the project got hacked

iongion commented 6 years ago

Created an issue for this only https://github.com/marcuswestin/store.js/issues/283 ... maybe a duplicate