Hongmu Notes

🚪 Escape encoding and decoding

Enter the text to get the %XX / %uXXXX encoding string. Enter the encoding string to restore the original text.

Escape encoding and decoding

Instructions for use

  • Encoding: Alphanumeric and @ * _ + - . / remain as they are, and the rest are converted to %XX or %uXXXX
  • Decoding: Restore %uXXXX and %XX into characters, which can be verified back and forth
  • Encoding is not encryption: no key is required, anyone can restore it, do not use it to store sensitive information

Escape encoding

Encodings starting with %u are common in script strings, logs, and data displays. Encodings are also used when Chinese characters need to be put into fields that only accept ASCII.

Which characters will be converted

Alphanumerics remain as is with @ * _ + - . /

Other characters with code points less than 256 are converted to %XX, and the remaining Chinese characters are converted to %uXXXX

Example of encoding results

Hello World is encoded as Hello%20World

"Chinese" encoding is %u4E2D%20%u6587

how length changes

Each encoded character becomes 3 or 6 bits, and the text containing Chinese will become significantly longer.

The pure English text is basically unchanged, and the content type can be judged based on this.

Why keep these 69 characters?

They make the results shorter and more readable without conflicting with the syntax

The criterion is that it will not conflict with the grammar, and edge symbols such as tildes will still be escaped.

What to check before copying

Check whether the beginning fragment corresponds to the first character

Check whether the fragment at the end is complete and there should be no isolated percent signs.

All keywords and tutorials 12

❓ FAQ

Can spaces and newlines be encoded?
Can. Spaces %20 and line breaks %0A will be encoded and retained. They will be restored to their original state during decoding, and the structure of multi-line text will not be lost.
Why does the result start with %u?
%uXXXX is a representation of non-ASCII characters. The four-digit hexadecimal digit is the code point of the character. When you see %u, you will know that it is followed by Chinese characters or other non-Latin characters.
How much will the length change after encoding?
Each encoded character will become 3 or 6 characters (%XX or %uXXXX), so text with more Chinese characters will become significantly longer, while pure English will remain basically unchanged.