allaire allaire - 1 year ago 89
Ruby Question

Maxmind Geoip city encoding issue

When configuring Max Mind with Nginx (using something like

proxy_set_header GEOIP_CITY $geoip_city;
), I get encoding issues with the city name when it has accents in it (like Montréal).

I’ve search everywhere and I can’t find an nginx switch to force utf-8 encoding. What am I missing?

I tried to
on ruby's side, but no dice.


Answer Source

Although it isn't documented, it appears that you can force the Nginx module to use UTF-8. To use this, I believe you load the database in the following manner:

http {
    geoip_city            GeoLiteCity.dat  utf8;