ColdFusion 10 REST API UTF-8 Characters
I'm using ColdFusion 10's new REST API and I'm having trouble with UTF-8
characters. It seems that ColdFusion 10's new REST API completely mangles
non-ASCII characters. Is there a way around this?
For example, let's say I have an endpoint like this:
<cfcomponent rest="true" restpath="/widgets" produces="application/json">
<cffunction name="echo" access="remote" httpmethod="PUT"
returntype="string">
<cfreturn GetHttpRequestData().content />
</cffunction>
</cfcomponent>
This endpoint simply responds with exactly what was sent in the request.
Here is my request:
PUT http://www.mycompany.com/rest/v1.0/widgets HTTP/1.1
User-Agent: Fiddler
Host: www.mycompany.com
Content-Length: 15
こんにちは
Here is the response I get:
HTTP/1.1 200 OK
Content-Type: application/json
Server: Microsoft-IIS/7.5
Date: Mon, 26 Aug 2013 23:59:09 GMT
Content-Length: 37
ã�"ã‚"ã�«ã�¡ã�¯
Note how the response is completely different from the request.
To be 100% certain that this is a problem with the request being mangled
by ColdFusion and not a problem with the response being generated by
ColdFusion, I enhanced the endpoint to also log the request body into a
database, and sure enough, it was already mangled.
Any way around this?
No comments:
Post a Comment