开发者

charset on REST API.. æøå

How to make æøå work in a response from a REST API?

The response is generated with json_encode() and since the input array must be utf8-encoded the special chars are not readable in the response..

I have tried to set the charset in the content-开发者_C百科type header, but still the same!?

Content-type: application/json; charset=utf-8

The special chars as æøå are still not readable!?

response

HTTP/1.1 200 OK
Date: Mon, 04 Jul 2011 16:16:16 GMT
Server: Apache
Content-Length: 91
Connection: close
Content-Type: application/json

{"result":[{"id":9,"name":"hehe \u00e6\u00f8\u00e5","type":0,"vatcode_id":0,"account":10}]}


Everything seems OK in your response. Control characters or non-ASCII characters are encoded by json_encode in the form \uXXXX. There's nothing wrong with that and the client should be able to understand those escape sequences.

There's also not much you can do about it, unless you want to post-process the output of json_encode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜