0

Is '' base64 encoded?

This question has this answer which suggests no:

if (str ==='' || str.trim() ===''){ return false; }

But some of the other approaches that use regular expressions return true ... For example:

https://stackblitz.com/edit/js-xjubhf

Thoughts?

Ole
  • 41,793
  • 59
  • 191
  • 359

1 Answers1

1

Yes.

An empty string is encoded (and so decoded) as an empty string in BASE64.

Note: The exact first reference test in the BASE64 standard is the empty string:

BASE64("") = ""

from RFC 4648.

Giacomo Catenazzi
  • 8,519
  • 2
  • 24
  • 32