Evidence-backed workflow test

Base64 and Unicode: A 10-Sample UTF-8 Round-Trip Test

Deterministic UTF-8 Base64 encode/decode fixtures for ASCII, accents, Cyrillic, Arabic, CJK, emoji, combining marks, newlines, empty input, and malformed decode.

Question
Does Base64 encode → decode restore the exact UTF-8 string for these scripts, and how does malformed input fail?
Samples
10 fixtures
Generated via core
10
Manual / limits
0
Published
Modified
Author
Dionis Ceban
Method
Nine round-trip fixtures call base64EncodeUnicode then base64DecodeUnicode from the shared core (TextEncoder/TextDecoder + btoa/atob). One malformed decode expects success:false. No cross-browser matrix beyond this Node/browser-shared algorithm.

Why this test matters

Base64 is often mistaken for encryption. Round-trip tests show it is encoding only, and that UTF-8 handling must stay consistent.

Tools under test

Result summary

10 of 10 fixtures were executed through assets/js/tools-src/core.js. 0 entries are labeled manual review or limitation without inventing a transform result.

Full test matrix (10 samples)
IDCaseInputOperationObservedStatus
b64-ascii-01 ASCII Hello encode → decode Exact round trip (SGVsbG8=) Pass
b64-latin-02 Accented Latin Café encode → decode Exact round trip (Q2Fmw6k=) Pass
b64-cyrillic-03 Cyrillic Привет encode → decode Exact round trip (0J/RgNC40LLQtdGC) Pass
b64-arabic-04 Arabic (RTL) مرحبا encode → decode Exact round trip (2YXYsdit2KjYpw==) Pass
b64-cjk-05 CJK 日本語テスト encode → decode Exact round trip (5pel5pys6Kqe44OG44K544OI) Pass
b64-emoji-06 Emoji Salut 👋 encode → decode Exact round trip (U2FsdXQg8J+Riw==) Pass
b64-combining-07 Combining characters encode → decode Exact round trip (ZcyB) Pass
b64-newlines-08 Line breaks line1 line2 line3 encode → decode Exact round trip (bGluZTEKbGluZTINCmxpbmUz) Pass
b64-empty-09 Empty input encode → decode Exact round trip () Pass
b64-malformed-10 Malformed Base64 decode !!!not-valid-base64!!! decode Invalid Base64 input. Please check your text and try again. Pass

Edge cases and failures

Combining accent e + U+0301 is preserved as separate code points; NFC/NFD normalization is not applied.

Conclusion

For these fixtures, UTF-8 round-trips are exact and malformed Base64 fails closed. Base64 remains encoding—not secrecy.

Limitations

  • Does not prove interoperability with every third-party Base64 dialect (line wrapping, URL-safe alphabets).
  • Does not encrypt or protect secrets.
  • Unicode normalization forms are not coerced.

Reproducibility

Re-run npm run guides:evidence. Encoded values in expected-results.json are generated from core.js, not hand-copied.

Downloadable evidence

Related experiments