What are the values that appear at the address bar?

218 views Asked by At

I am working on a webiste that translates an input string from Japanese to English.

This webiste has two text fields and one button to submit the string for translation.

But when I hit the button, I can see some kind of hexadecimal values separated by % in the address bar. I just want to know, are these haxadecimal values are the values of the input string and why they get seperated by %?

Is there any rule behind it that values seperated by spaces gets coverted to hexadeciaml and separated by %?

For ex- localhost/translator/?hl=ja#ja/en/%E6%9C%AC%E6%97%A5%E3%80%81%20%E3%83%97%E3%83%AC%EF%BC%95S%E3%83%91%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB%E5%AE%9F%E6%96%BD%E3%81%97%E3%81%BE%E3%81%99%2013%3A30%EF%BD%9E%E3%80%82%EF%BC%88%E6%9C%AC%E7%95%AA%EF%BC%9A6%2F17%EF%BC%88%E6%B0%B4%EF%BC%89

Looking forward to your answers.

2

There are 2 answers

0
Michael Oryl On BEST ANSWER

What you are seeing is called URL Encoding. It allows characters that are not legal for a URL to be represented by only legal characters.

You are right, they are hex numbers.

For example, if you wanted to represent the # character in a URL parameter, you would use %23 to do so. If you just put the # character in there, it would be interpreted as an anchor target on the page that was being requested, which would not be what you wanted.

So what you are seeing is your form input being converted into these hex codes. Why, I'm not sure without seeing your code and the actual data you are putting in the form. You could avoid it by using a POST instead of a GET for that form action, though.

0
Chand Priyankara On

1.some kind of Hexadecimal values separated by % at the address bar:

Browser converts your input data to URL string through UTF-8 encoding. This is because, before sending as a URL string, it has to remove conflicting characters with standard URL keywords.

Ex: '?' is used to separate URI and parameters in a HTTP request. So if your input has '?' this becomes an issue. Because the server doesn't know where to split URI and parameters.

Additionally it seems like you are doing a HTTP GET request. But I think its better you do a POST request.

You can avoid seeing this lengthy address.

There is limitation [by browser] of the length of your input.