I have created a CFFunction
that returns JSON from a query, but it is not returning special characters correctly.
I have checked the record in the database and it is saving correctly in the database so I know the problem is with the API.
Below is the main of my cffunction
:
<cffunction name="getNews" access="remote" httpmethod="GET" returntype="array" produces="application/json>
I have even tried adding charset=utf-8 at the end:
<cffunction name="getNews" access="remote" httpmethod="GET" returntype="array" produces="application/json; charset=utf-8">
but this still does not return the correct characters.
If there is anything else you need let me know, hopefully someone will have come across this issue before.
I managed to fix the problem:
-Dfile.encoding=UTF8
I didn't have to change any other details in my API. Once I restarted the server the JSON came through correctly.