You can either use URL encoding , where each character without an ASCII character is encoded as a character %followed by two hexadecimal digits, or you use base64 encoding , where each set of 3 bytes is encoded into 4 ASCII characters (3x8 bits → 4x6 bits).
For example, if you have the following bytes:
00 01 41 31 80 FE
You can encode the URL as follows:
%00%01A1%80%FE
Or you can encode base64 like this: 0-25 = AZ, 26-51 = az, 52-62 = 0-9, 62 =., 63 = /:
(00000000 00000001 01000001) (00110001 10000000 11111110) -->
(000000 000000 000101 000001) (001100 011000 000011 111110)
AAJBNYD.
dbush source
share