Base64 encode
What this is
Classic window.btoa breaks on emoji and non-Latin-1. The correct path is TextEncoder → binary string → btoa. Use this for HTTP Basic, data URIs, and embedding small files in JSON.
Open the encoder — UTF-8 and base64url, no upload.
FAQ
- Why not btoa(text)?
- btoa expects bytes as a binary string of code units 0–255. Passing a JS string with code points > 255 throws. Encode UTF-8 first.