iWeltAG / pinia-cached-store

Pinia store extension that allows transparent caching of state in local storage.
https://www.npmjs.com/package/pinia-cached-store
MIT License
21 stars 0 forks source link

Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range. #6

Closed productdevbook closed 2 years ago

productdevbook commented 2 years ago
yrd commented 2 years ago

This should be fixed onced the next version is released. I have introduced a workaround on how JavaScript handles Unicode when encoding to (and from) base64. Note that this also means that the storage size required for you cache is effectively doubled once you use any Codepoint above \x00ff (because internally, strings are still UTF-16 and we split up all the larger codepoints into two). This should no longer be a problem once (if) we move away from base64 to something more compress-y like zlib or gzip.