Bug #19196
Updated by westoque (William Estoque) almost 2 years ago
When I am reading the string response from a URI.open, the response is not equivalent to the response body. URI.open escapes the response body string. How to reproduce: ``` url = "https://www.podcastone.com/podcast?categoryID2=1237" handle = URI.open(url) => #<Tempfile:/path/to/tempfile> puts handle.read .... https://dts.podtrac.com/redirect.mp3/pdst.fm/e/chrt.fm/track/E2G895/aw.noxsolutions.com/launchpod/adswizz/1237/762-FeedbackFriday-249-V2_mzwq_b1dc1677.mp3?awCollectionId=1237&awEpisodeId=ee01b21a-878d-4be4-974c-e504b1dc1677&adwNewID3=true&awNetwork=309... ``` In The string in the browser, the actual string reads: browser says "https://dts.podtrac.com/redirect.mp3/pdst.fm/e/chrt.fm/track/E2G895/aw.noxsolutions.com/launchpod/adswizz/1237/762-FeedbackFriday-249-V2_mzwq_b1dc1677.mp3?awCollectionId=1237&awEpisodeId=ee01b21a-878d-4be4-974c-e504b1dc1677&adwNewID3=true&awNetwork=309" ``` https://dts.podtrac.com/redirect.mp3/pdst.fm/e/chrt.fm/track/E2G895/aw.noxsolutions.com/launchpod/adswizz/1237/762-FeedbackFriday-249-V2_mzwq_b1dc1677.mp3?awCollectionId=1237&awEpisodeId=ee01b21a-878d-4be4-974c-e504b1dc1677&adwNewID3=true&awNetwork=309 ``` Notice the characters `#38;` "&" My initial research is that it's because the Tempfile that gets created is in ascii-8bit, and in ascii-8bit, ascii-8bit which the amperstand is a "38". I propose that we We should have create a way to force the encoding of the Tempfile to UTF8 so that this character is not escaped and the string encoding is preserved. escaped.