Base64 encodes binary data into four-byte readable characters per three bytes. The encoded characters are about 136.1% characters in length. Character range is A-Z A-Z 0-9 \ +. However, the encoded string is not suitable for URL transmission. The garbled characters after Chinese encryption are also caused by this reason: When the string is transmitted in the URL, the plus sign will be replaced with a space; a newline "\ n" is added for every 76 characters, which will be lost.
For example:
Haha ....
Haha ....
Haha ....
Will be encoded:
Uf65/rn + uf65/rn + oaoho6gjdqoncrn + uf65/rn + uf65/qgjoaohow0kdqq5/rn + uf65/rn + uf6h \ no6gjoam =
When it is transmitted in the URL, it will become:
Uf65/RN uf65/RN oaoho6gjdqoncrn uf65/RN uf65/qgjoaohow0kdqq5/RN uf65/RN uf6h
O6gjoam =
There will be problems with parsing.
Therefore, the following processing is required during transmission and decryption:
1. Remove \ n
2. Replace the space with +