Score:0

How to replace special characters variable value nginx

cn flag

I'm out of ideas to solve the following issue:

I use GeoIP with nginx server. I installed the module and I have the following under http context in nginx.conf:

    geoip2 /usr/share/GeoIP/GeoLite2-Country.mmdb {
        $geoip2_data_country_code default=NA country iso_code;
        $geoip2_data_country_name default=NA country names en;
        $geoip2_data_city_name default=NA city names en;
    }
    geoip2 /usr/share/GeoIP/GeoLite2-City.mmdb {
        $geoip2_data_city_name default=NA city names en;
        $geoip2_data_state_name default=NA subdivisions 0 names en;
        $geoip2_data_state_code default=NA subdivisions 0 iso_code;
    }

I use geoip2 variables to create another header (using map directive), like so:

map $geoip2_city_name $city_code {
default "NA/LIST";
"Dusseldorf" "025633";
"Munster" "048633";
.....
}

The problem I have is that even in English GeoIP gives me special chars such as ä, æ, ü, ö, ï..., and the map list don't have those values (I can't change the list).

So My question is how can I "force/change" the variable geoip2_city_name to use utf-8 characters? Example:

Düsseldorf => Dusseldorf
Mönchengladbach => Monchengladbach
Würzburg => Wurzburg

I have tried to set:

    charset utf-8;
    source_charset utf-8;

On http context but didn't worked.

Thank you add in advance!

I have tried to use chatsets directives inside http context, and expected the change from special chars to utf-8.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.