I don't know rails very much and I'm kind of struggling with a post body 
json string. ContentType headers in the request is set to 
"application/json; charset=UTF-8" and rails seems to parse it and put it in 
the parameters.

But my first instinct was to put the body in a string and proxy it to my 
http client who call an external service, but I got some encoding problem 
ASCII-8BIT != UTF-8. 

If I understand request.body create a StringIO with hardcoded encoding 
ASCII-8BIT and request.body.string keep that encoding. Is there a reason 
for that? 

So I need to do something like request.body.string.force_encoding("utf8") 
or params.to_json. What would be best practice for this use case?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to