I am posting data to a site that often includes French characters. This site has a form which handles the French characters fine but I had trouble when sending doing this inside a node program.
An example would be a field with the name: "Maevà". When I look at the dev tools in chrome I can see that the request encodes this name as: Maev%E0
.
This works fine and in my code if I use escape(Maevà)
it returns Maev%E0
which works perfectly.
Unfortunately escape is deprecated so I tried to use encodeURIComponent and encodeURI but they both return Maev%C3%A0
which does not work.
Is there something else I can use?
Maev%C3%A0
is the correct encoding. You can see it correctly populating the input when used in a Google Search URL - google.com/search?q=-----Maev%C3%A0----- (it sounds like you have a problem with whatever code you have to decode that data and you should be looking to fix that instead of trying to reproduce the behaviour ofescape
) – Carranzaescape
? – Supremacist