Search code examples
httppostangularjsspecial-characters

angularjs $http POST special characters


I have a requirement to accept Special Characters (àéïôûç) in name fields.

1) Following JavaScript logic path HTML <form> to function w/ $http POST, the special characters are intact.


2) calling code:

     $http({

url: formServiceUrl,
method: 'POST',
data: $scope.model,
headers: {'Content-Type': 'application/json'}
}).success( ...


    a) added additional header to test: , 'Accept-Charset': 'utf-8' this fails too.


3) Chrome Devtool network tab shows:
INPUT {broswer console}:

àéïôûç 

TRANSLATED to {Devtools Network POST payload}:
à éïôûç


4) Is there an $http option that will send the special characters as they were entered?
    Is there something else I need to try?

Thank you


FYI:
a) Using CHROME browser only right now

b) parent HTML page has meta-tag:

<meta content="IE=Edge" charset="iso-8859-1" http-equiv="X-UA-Compatible">

Solution

  • ANSWER: Angular is appropriately encoding the data and sending to the Services Layer. Logging out the data from services side shows it is being received correctly.

    Another service is causing a 500 Internal Service Exception because it isn't handling special characters correctly.