fotinakis / jsonapi-serializers

Pure Ruby readonly serializers for the JSON:API spec.
MIT License
414 stars 91 forks source link

output should be UTF-8, but is ASCII #103

Closed susca closed 7 years ago

susca commented 7 years ago

The output generated by jsonapi-serializers is ASCII encoded, the disadvantages of which are obvious (I hope). Is there a way that jsonapi-serializers can output UTF-8 that I missed?

Otherwise this is a feature-request.

fotinakis commented 7 years ago

jsonapi-serializers doesn't explicitly do any string encoding I don't think, we just return a Ruby hash, which is then the responsibility of the containing application to serialize to JSON. I believe that kind of encoding error you're seeing has to be an app-specific issue, can you give more info on where you're seeing it?

susca commented 7 years ago

Turns out, it was UTF-8 but rails (ruby?) escapes non-ascii characters anyway. There is a workaround in one of the answers to this question as well as some explanation: http://stackoverflow.com/questions/5123993/json-encoding-wrongly-escaped-rails-3-ruby-1-9-2