blakeembrey/universal-base64

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

frntendev opened this issue · 2 comments

Hi,
I'm facing an issue where I'm going to encode utf-8 characters using this library. Could you provide me a solution?

@Sepehr1313 Probably would need to URL encode or something else before passing it into the library. There's some solutions in https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem. It would make sense to ensure these align across node.js and browser though, so I can test it.

Fixed with https://github.com/blakeembrey/universal-base64/releases/tag/v2.1.0! Let me know if it resolves things for you 😄