notepadlet
notepadlet copied to clipboard
Characters outside Latin-1 range crash the notepadlet
Characters outside Latin-1
seem to crash the notepadlet on save.
Sample characters to crash the app:
✓😍🤔
Error:
Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
I have fixed this by replacing btoa code with:
var blob = new Blob([document.documentElement.outerHTML],{type : 'text/html;charset=utf8'});
var a = new FileReader();
a.onload = function(e) {
window.location = e.target.result;
};
a.readAsDataURL(blob);
Wanted to create a feature branch but couldn't figure out where is the html code :)
@erdemguven looks good! If you want to do a PR, you can find the html code at the gh-pages
branch :)