I have a problem with encodeURIComponent() as it seems to behave differently than browsers (tested with Chrome and Firefox):
encodeURIComponent('ä')returns%C3%A4escape('ä')returns%E4- Chrome/Firefox encodes
äin x-www-form-urlencoded forms as%E4
So, why does encodeURIComponent behave differently than all the others (mainly browsers)? This actually causes problems as some websites don't understand what I'm trying to feed them. The website in question is http://verkkopalvelu.vrk.fi/Nimipalvelu/default.asp?L=1 (click "Etunimihaku" as it is iframe based).
Is encodeURIComponent broken and how should this situation be corrected? What would be the correct way to encode characters like ä ö å? escape() seems to encode the same as those browsers, but escape() is deprecated.
I tested the browsers with Fiddler and also the Console/Network tab shows the encoding as %E4 when I submit a form. Also a test link here: A http://jsfiddle.net/tcyfktvg/1/