Base64 guides

Base64 and UTF-8 Character Sets

Base64 encodes bytes, not characters. UTF-8 converts characters into one or more bytes first; Chinese characters and emoji use several. A mismatch produces mojibake or decoding errors.

Choose an explicit charset

Document UTF-8 at every browser, API, and database boundary. Decode Base64 to bytes first, then decode those bytes as UTF-8.

Detecting a mismatch

If ASCII works but accented text fails, inspect the declared charset, newline conversion, and whether the producer used standard Base64 or Base64URL. Compare byte lengths.

Practical check

Encode café / 世界 / 🚀 with the text encoder, then decode it and compare the original characters.