POST coding

Asked

Viewed 85 times

2

In web requests when posting data on a server string of the model below (using the parameters):

string hello = "hello";
string token = "teste==";

It is transformed into post data equal to those shown below:

string post = "msg=hello&token=teste%3D%3D";

What kind of encoding was used here, I know that JSON class serializer can be used to serialize parameters, but, which encoding was used above?

1 answer

1


This is called Percent encoding. It is used to escape characters that are part of the content but are confused with special characters used in specific indications of URL/URI. All basic text characters are called unreserved characters. The same goes for binary data encoding since they run away from common text (unreserved characters) and need to escape the representation of all possible 256 bytes.

To RFC 3986 describes this.

The character encoding depends on what has been established, it is very common on the web to be UTF-8, but it is not mandatory, I for example avoid using it.

  • And as almost always, the wikipedia in Portuguese with half content. For those who do not know, it is often difficult to collaborate with the WP in PT (I have already given up) because there are some Portuguese-speaking colonels who do not understand anything, but make sure to put the nose to the name appear in the issue (and as soon as they arrived at the post of "colonel"). For those who are curious, or want to improve the article, follow the link: https://pt.wikipedia.org/wiki/Codifica%C3%A7%C3%A3o_por_cento (the literal translation of the title tb became strange)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.