Open yudi-matsuzake opened 8 years ago
Hm... you'd probably want to adapt the JSONAPIAdapter. What is your current output and what is the output that you actually desired? Can you give me an example?
The current output:
{"data": {"relationships": {}, "attributes": [[{"id": 0, "species": "C\u00e3o"}, {"id": 1, "species": "Gato"}, {"id": 3, "species": "P\u00e1ssaro"}], {"links": {"previous": null, "next": null}}], "type": "species", "id": "", "links": {"self": "http://127.0.0.1:5000/catabicho.api/species"}}}
Desired output:
{"data": {"relationships": {}, "attributes": [[{"id": 0, "species": "Cão"}, {"id": 1, "species": "Gato"}, {"id": 3, "species": "Pássaro"}], {"links": {"previous": null, "next": null}}], "type": "species", "id": "", "links": {"self": "http://127.0.0.1:5000/catabicho.api/species"}}}
Basically the words "cão" and "pássaro" encoded with utf8.
Today a want to adapt the JSONAPIAdapter. Later I'll tell the results.
I just put ensure_ascii=False in every json.dumps call and worked. Do you have any problem in mind that may appear when you add to JSONAPIAdapter? If you are interested I can make a pull request.
I'm implementing a RESTful server that reponses in the portuguese language and with the
ensure_ascii=True
the 'ã' looks like '\u00e3' in the json responses.Is there any problem what will cause make this change (
ensure_ascii=False
)? Or is there any way to implement an option to JSONAPIAdapter call json.dumps with the argumentensure_ascii=False
?I think that decode the json to utf8 is not job for the client application.
Maybe can I use the postprocessors in some way?