lib/patentscope/client.rb in patentscope-0.0.4 vs lib/patentscope/client.rb in patentscope-0.0.5
- old
+ new
@@ -24,10 +24,12 @@
request["User-Agent"] = USER_AGENT_STRING
request["Content-Type"] = content_type
request.body = body
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
- response = http.request(request)
+ response = http.request(request)
+ response.body = response.body.force_encoding("ISO-8859-1").encode("UTF-8")
+
if response.header["Content-Type"].include? "text/html"
response.body
elsif response.header["Content-Type"].include? "multipart/related"
response.body.split("\r\n\r\n")[1].split("\r\n")[0]
end