I'm making an API request with Faraday in Ruby and I'm parsing it with JSON.parse
. The problem is that, the JSON response has sentences such as Longitud de la estaci\u00F3n meteorol\u00F3gica (grados)
but it should be Longitud de la estación meteorológica (grados)
.
Is there a way to properly parse this?
I have connection = Faraday.new(my_site)
and if I do connection.get.body.encoding
, then I get #<Encoding:ASCII-8BIT>
, but when I try connection.get.body.force_encoding('ASCII-8BIT).force_encoding('UTF-8)
or connection.get.body.force_encoding('ASCII-8BIT).encode('UTF-8)
I get 'encode': "\xF3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
.
Thanks a lot in advance!