From ff192526fbe46e2b97eef0111442c9eacd7e956f Mon Sep 17 00:00:00 2001 From: Olivier Gonzalez <olivier.gonzalez@tech-angels.com> Date: Sun, 22 Sep 2013 18:36:03 +0200 Subject: [PATCH] Fix Maxmind result encoding --- lib/geocoder/lookups/maxmind.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/geocoder/lookups/maxmind.rb b/lib/geocoder/lookups/maxmind.rb index 2ecb4c66..631c4764 100644 --- a/lib/geocoder/lookups/maxmind.rb +++ b/lib/geocoder/lookups/maxmind.rb @@ -71,7 +71,9 @@ module Geocoder::Lookup end def parse_raw_data(raw_data) - CSV.parse_line raw_data + # 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 -- GitLab