Encode and decode Base64, including Unicode text.
Handles UTF-8 properly, so emoji and Cyrillic survive the round trip. Also accepts URL-safe Base64 on decode.