I have a simple app that uses a jquery ajax request to send form data to a node server, which in turn submits to a third party api using the Request module for node js.
The issue I'm having is that accented (and other similar) characters are not encoded correctly when they reach the third party server. For example é is recorded as é
I am fairly sure this is to do with the settings for Request as I get the same results when I bypass the ajax call.
Here are the settings I am using:
html:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
jquery ajax settings:
type : 'POST',
url : '/api',
data : formData, // A json object
dataType : 'json',
ContentType : 'text/html; charset=utf-8'
Request module settings in node (there is nothing happening to the form data between ajax post and being sent by request):
request.post({
url: "https://testurl.com/api/",
form: formData,
headers: {'Content-Type': 'application/json; charset=utf-8'}
} ...
I have read various SO solutions but had no success, so any suggestions greatly appreciated.