Monday, 20 November 2017

encoding HTTP request characters & > " < ' &amp; &gt; &quot; &lt; &apos; %22%27%3C%3E%26


Encoded request for """Test msg AMP GT QUOT \r &>"\r"""
POST /test HTTP/1.1
content-type: application/x-www-form-urlencoded
Host: test:8080
Content-Length: 133
various_params=whatever&text=Test+msg+AMP+GT+QUOT+%c3%96r+%26%3e%22%c3%96rHTTP/1.1 200 OK
https://www.url-encode-decode.com/
TEST AMP GT QUOT SLASHR & > " \r
TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
INPUT:
TEST AMP GT QUOT SLASHR & > " \r
TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
0:    (  2  <  F  P  Z  d   n   x
1:    )  3  =  G  Q  [  e   o   y
2:    *  4  >  H  R  \  f   p   z
3: !  +  5  ?  I  S  ]  g   q   {
4: "  ,  6  @  J  T  ^  h   r   |
5: #  -  7  A  K  U  _  i   s   }
6: $  .  8  B  L  V  `  j   t   ~
7: %  /  9  C  M  W  a  k   u  DEL
8: &  0  :  D  N  X  b  l   v
9: ´  1  ;  E  O  Y  c  m   w

HTTP request encoded OUTPUT:

TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
TEST%2BAMP%2BGT%2BQUOT%2BSLASHR%2B%2526%2B%253E%2B%2522%2B%255Cr%250D%250A%0D%0A
0%3A++++%28++2++%3C++F++P++Z++d+++n+++x%0D%0A
1%3A++++%29++3++%3D++G++Q++%5B++e+++o+++y%0D%0A
2%3A++++%2A++4++%3E++H++R++%5C++f+++p+++z%0D%0A
3%3A+%21++%2B++5++%3F++I++S++%5D++g+++q+++%7B%0D%0A
4%3A+%22++%2C++6++%40++J++T++%5E++h+++r+++%7C%0D%0A
5%3A+%23++-++7++A++K++U++_++i+++s+++%7D%0D%0A
6%3A+%24++.++8++B++L++V++%60++j+++t+++%7E%0D%0A
7%3A+%25++%2F++9++C++M++W++a++k+++u++DEL%0D%0A
8%3A+%26++0++%3A++D++N++X++b++l+++v%0D%0A
9%3A+%C2%B4++1++%3B++E++O++Y++c++m+++w%0D%0A

TABLE: (with SPACE chars stripped)

0%3A        %28 2   %3C F P Z   d n x    %0D%0A
1%3A        %29 3   %3D G Q %5B e o y    %0D%0A
2%3A +      %2A 4   %3E H R %5C f p z    %0D%0A
3%3A %21    %2B 5   %3F I S %5D g q %7B  %0D%0A
4%3A %22    %2C 6   %40 J T %5E h r %7C  %0D%0A
5%3A %23    -   7   A   K U _   i s %7D  %0D%0A
6%3A %24    .   8   B   L V %60 j t %7E  %0D%0A
7%3A %25    %2F 9   C   M W a   k u DEL  %0D%0A
8%3A %26    0   %3A D   N X b   l v      %0D%0A
9%3A %C2%B4 1   %3B E   O Y c   m w      %0D%0A
Encoding of SPACE is + or %20. 
Encoding of ' ? %27 or %C2%B4 ?
The ' char from man ascii was not '! But ´. Interesting.
Encoding of ' is %27.



XML escape characters

There are only five:

"   &quot;  %22
'   &apos;  %27
<   &lt;  %3C
>   &gt; %3E
&   &amp; %26

All 5 special characters must not be escaped in comments or CDATA sections or XML processing instructions.




ASCII table from man ascii linux

  30 40 50 60 70 80 90 100 110 120
 ---------------------------------
0:    (  2  <  F  P  Z  d   n   x
1:    )  3  =  G  Q  [  e   o   y
2:    *  4  >  H  R  \  f   p   z
3: !  +  5  ?  I  S  ]  g   q   {
4: "  ,  6  @  J  T  ^  h   r   |
5: #  -  7  A  K  U  _  i   s   }
6: $  .  8  B  L  V  `  j   t   ~
7: %  /  9  C  M  W  a  k   u  DEL
8: &  0  :  D  N  X  b  l   v
9: ´  1  ;  E  O  Y  c  m   w

No comments: