Base64 encoding Allowed Characters

后端 未结 3 618
清酒与你
清酒与你 2021-02-05 01:09

I\'m using Base64 encoding for encoding user id field in Java.

String abc = new String(Base64.encodeBase64(\"Actualuseridfield\"));

I want to k

相关标签:
3条回答
  • 2021-02-05 01:48

    transforming "weird" and non printable characters is kind of the whole point of base64, so no, you wont see those. more info here http://email.about.com/cs/standards/a/base64_encoding.htm

    0 讨论(0)
  • 2021-02-05 01:51

    You will not see any commas, colons, or double quotes in a Base64 encoded string. You will see equals signs since they're used to pad the ending content.

    0 讨论(0)
  • 2021-02-05 01:56

    If you have a proper encoder for Base64, you will not see special characters except:

    [A-Z][a-z][0-9][+/] and the padding char '=' at the end to indicate the number of zero fill bytes

    There is another Base64 character set available which replaces [+/] by [_-] making the encoding URL-safe.

    Nevertheless the specification allows to include any other character. Often the Base64 encoded data contains a line feed '\n' every 76 characters. Any character except the ones mentioned above has to be removed during decoding. The padding characters indicate the number of zero bytes appended to apply to n*4 output characters.

    0 讨论(0)
提交回复
热议问题