-
Notifications
You must be signed in to change notification settings - Fork 523
Fix encoding for geoip provider #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Geoip module return ISO-8859-1 encoded strings. Special characters are broken if not converted to utf8 before applying any transformation (like https://github.com/willdurand/Geocoder/blob/master/src/Geocoder/Result/AbstractResult.php#L64)
|
Good catch, we get {"latitude":47.561199188232,"longitude":17.184400558472,"bounds":null,"streetNumber":null,"streetName":null,"zipcode":"","city":"Bogyoszl","cityDistrict":null,"county":null,"countyCode":null,"region":"Gyor-Moson-Sopron","regionCode":"09","country":"Hungary","countryCode":"HU","timezone":"Europe\/Budapest"}Maybe it's better to fix the |
|
I tried to replace the |
|
This seems to be a bug : http://de2.php.net/manual/de/function.mb-detect-encoding.php#55228 |
|
Did you tried the Something like: $str = mb_detect_encoding($str, 'UTF-8', true) ? $str : utf8_encode($str); |
|
It only works with |
|
Ok, so your solution is the best I guess 👍 |
|
If geoip is the only provider which returns non-utf8 strings, indeed the initial solution is maybe better ! |
|
I agree :) |
Fix encoding for geoip provider
|
thanks! |
|
yes! thanks! |

Geoip module return ISO-8859-1 encoded strings. Special characters are broken if they are not converted to utf8 before applying a transformation (like in https://github.com/willdurand/Geocoder/blob/master/src/Geocoder/Result/AbstractResult.php#L64)
You can try with this IP : 79.120.148.112 (Bogyoszló)