wrong content type for JSON data


My set up: CF7, oracle, coldbox 2.6.4.

I'm developing an autosuggest box that supports any character set.
It'll be used to select organisations from all over the world, and I
want to allow users to enter the organisation name in its original
language, e.g. if it's a greek organisation users can enter either its
english name, or its greek name.

The event handler returns the original query, and an array of matching
organisations. The event handler works fine if I type names in english
but, if I type something in non ascii characters, the original query
is returned as the infamous "???".

This is what I use to return the data: <cfset
Event.renderData(type="JSON", data=autoCompleteResponse) />

autoCompleteResponse is just a struct with the original query, and the
array with the matching organisations.

Using firebug I've examined the response, and no matter what I do, the
Content-Type returned is always "text/plain". I've also tried using
<cfset Event.renderData(type="JSON", data=autoCompleteResponse,
contentType="text/json") />, but the content-type does not change.

What am I doing wrong? Should I use another data type (XML, or WDDX)?



Pedro, I ran into a similar situation a while back. The fix (for me, anyway) was to add a little something to the content type.

contentType=“application/json; charset=UTF-8

Thanks Doug!