From: "uggsoutlet (uggsoutlet uggsoutlet)" Date: 2012-11-22T15:27:35+09:00 Subject: [ruby-core:49856] [ruby-trunk - Feature #2567] Net::HTTP does not handle encoding correctly Issue #2567 has been updated by uggsoutlet (uggsoutlet uggsoutlet). =begin would be an excellent rule. Such an attitude would emphasize (()) sharply the value of life. Every day we should with gentleness, vigor, hold (()) the heart of thanksgiving to life. But when the time for endless days, months and years passed in (()) front of us, we are often not the seed feeling. Of course, there is also " eat, drink, enjoy .458gyu854 =end ---------------------------------------- Feature #2567: Net::HTTP does not handle encoding correctly https://bugs.ruby-lang.org/issues/2567#change-33468 Author: slide_rule (Ryan Sims) Status: Assigned Priority: Low Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 =begin A string returned by an HTTP get does not have its encoding set appropriately with the charset field, nor does the content_type report the charset. Example code demonstrating incorrect behavior is below. #!/usr/bin/ruby -w # encoding: UTF-8 require 'net/http' uri = URI.parse('http://www.hearya.com/feed/') result = Net::HTTP.start(uri.host, uri.port) {|http| http.get(uri.request_uri) } p result['content-type'] # "text/xml; charset=UTF-8" <- correct p result.content_type # "text/xml" <- incorrect; truncates the charset field puts result.body.encoding # ASCII-8BIT <- incorrect encoding, should be UTF-8 =end -- http://bugs.ruby-lang.org/