>> Store serialized state
Learnt recently that Base64 encoding and decoding in JS doesn't quite handle Unicode strings. One solution[1] is to URI encode/decode the text (e.g. JSON):
base64 = btoa(encodeURIComponent( str ))
str = decodeURIComponent(atob( base64 ))
[1] https://developer.mozilla.org/en-US/docs/Glossary/Base64#the...