Remove trailing “=” when base64 encoding

前端 未结 9 2029
时光取名叫无心
时光取名叫无心 2020-11-29 23:58

I am noticing that whenever I base64 encode a string, a \"=\" is appended at the end. Can I remove this character and then reliably decode it later by adding it back, or is

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 00:27

    = is added for padding. The lenght of a base64 string should be multiple of 4, so 1 or 2 = are added as necessary.

    Read: No, you shouldn't remove it.

提交回复
热议问题