Email
Email

Reputation: 2425

What characters uses base64encode?

I refer to the base64 encode function like seen here

It might sound stupid but which characters does this use??

I know letter, digits and 've seen also the equal-sign (=). But i search for a 100% definition.

I need this because i use a base_64 encoded string in supposed-to-be valid html as an attribute and want to avoid conflicts.

Upvotes: 4

Views: 3037

Answers (2)

Gumbo
Gumbo

Reputation: 655239

The default character set of the Base 64 encoding is AZ (0–25), az (26–51), 09 (52–61), + (62), and / (63). The = is used as padding character to fill the value up to a length of a multiple of 24 bits.

There are also alternative character sets like one that is safe to be used in URLs. But you could also use any other character set.

Upvotes: 8

alex
alex

Reputation: 490213

Base 64 encoding uses a-z, A-Z, 0-9, + and / in many implementations.

There may also be trailing = characters to denote padding.

Upvotes: 1

Related Questions