Skip to content
Snippets Groups Projects
Commit 61a4ddb4 authored by Olivier Gonzalez's avatar Olivier Gonzalez
Browse files

convert whole response string to utf-8

parent e391cf70
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,9 @@ module Geocoder::Lookup
end
def parse_raw_data(raw_data)
CSV.parse_line raw_data # Maxmind just returns text/plain as csv format
# Maxmind just returns text/plain as csv format but according to documentation,
# we get ISO-8859-1 encoded string. We need to convert it.
CSV.parse_line raw_data.force_encoding("ISO-8859-1").encode("UTF-8")
end
def reserved_result
......
......@@ -17,9 +17,7 @@ module Geocoder::Result
end
def city
# According to Maxmind documentation, we get ISO-8859-1 encoded string :
# "Name of city or town in ISO-8859-1 encoding"
@data[2].force_encoding("ISO-8859-1").encode("UTF-8")
@data[2]
end
def postal_code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment