You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, the attachment is a PDF document generate by prawnPDF. Its encoding is ASCII-8BIT. (I'm wrapping it in StringIO thingy just so I can do .read on it)
If I call HTTParty::Request::Body.new(params) everything is great.
It's basically assumes that attachment's .read method will always return an UTF-8 encoded payload. Is that always true? What is a sensible work-around here?
Thanks!
The text was updated successfully, but these errors were encountered:
@GBH Did anyone find a work around for this? I am having this same issue uploading a jpg file, while at the same time sending a string that is in UTF-8.
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
When trying to create a POST with an attachment I'm running into this issue. Here's a simple example:
Now, the
attachment
is a PDF document generate by prawnPDF. Its encoding isASCII-8BIT
. (I'm wrapping it in StringIO thingy just so I can do.read
on it)If I call
HTTParty::Request::Body.new(params)
everything is great.However, if I change
Gunter
toGünter
by introducing UTF-8 character I end up withincompatible character encodings: UTF-8 and ASCII-8BIT
. Coming from here: https://github.com/jnunemaker/httparty/blob/master/lib/httparty/request/body.rb#L42It's basically assumes that attachment's
.read
method will always return an UTF-8 encoded payload. Is that always true? What is a sensible work-around here?Thanks!
The text was updated successfully, but these errors were encountered: