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
MRI outputs ASCII-8BIT, whereas JRuby outputs UTF-8 encodings. The same thing happens when I swap the endpoint with http://httpbin.org/encoding/utf8.
I'm note sure what should be the correct general behaviour, whether chunks should always be in binary encoding, or only when charset isn't specified. But it seems that me that in the latter case the encoding should always be binary, both in MRI and JRuby.
I'm not sure yet whether this cross-Ruby inconsistency comes from HTTP.rb or http_parser.rb, but just wanted to report it here. I think a good solution would be to call force_encoding on the result of Response::Body#readpartial (just like we're doing in Response::Body#to_s).
The text was updated successfully, but these errors were encountered:
It's definitely on our end (not http_parser.rb, as it's only responsible for headers parsing). And I agree that chunks must be either in encoding specified in headers, or binary (I believe we had that somewhere).
MRI will return content read from the socket in the ASCII-8BIT (binary)
encoding, whereas JRuby will return it in the UTF-8 encoding. In
whichever encoding the body is retrieved, we want to force its encoding
to the one specified (charset response header if present, otherwise
binary). This is already the behaviour in Response#to_s, we just extend
it to Response#readpartial as well.
Fixeshttprb#413
When I run the following:
MRI outputs
ASCII-8BIT
, whereas JRuby outputsUTF-8
encodings. The same thing happens when I swap the endpoint withhttp://httpbin.org/encoding/utf8
.I'm note sure what should be the correct general behaviour, whether chunks should always be in binary encoding, or only when charset isn't specified. But it seems that me that in the latter case the encoding should always be binary, both in MRI and JRuby.
I'm not sure yet whether this cross-Ruby inconsistency comes from HTTP.rb or http_parser.rb, but just wanted to report it here. I think a good solution would be to call
force_encoding
on the result ofResponse::Body#readpartial
(just like we're doing inResponse::Body#to_s
).The text was updated successfully, but these errors were encountered: