I thought that the values entered into the forms are correctly encoded by browsers.
But this simple test file test_get_vs_encodeuri.html shows that it is not:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head><body>
<form id="test" action="test_get_vs_encodeuri.html" method="GET" onsubmit="alert(encodeURIComponent(this.one.value));">
<input name="one" type="text" value="Euro-€">
<input type="submit" value="SUBMIT">
</form>
</body></html>
When you click the submit button:
encodeURICompenent encodes the input value to "Euro-% E2% 82% AC"
, while the browser only writes a simple “Euro-% 80” to the GET request
Or does encodeURIComponent do unnecessary conversions?