UTF-8 for header cf-ipcity is not supported (diacritics)

hi there,

UTF-8 for header cf-ipcity is not supported (diacritics). For example Sao Paulo returns as “São Paulo”

I believe it is UTF-8. City names come from Maxmind, and just need to be decoded properly at your end. It should show up correctly here:


thanks sdayman,
i dont see cf-ipcity in your link

Let me assure you it comes from cloudflare directly. We use latest node, with latest express, and we’re an international app, we don’t have UTF8 problems.

This is what happens when we console.log headers['cf-ipcity'] and my ip address is in Sao Paulo

thanks man

That’s wierd. I didn’t think I deleted that transform rule. I’ve re-added it.

It should now show an X-Copied-From-Ip-Src-City header.

thanks for your help, as you can see it’s scuffed on your version aswell

1 Like

I’ve added a content-type header for UTF-8 decoding. I set it to HTML, so the JSON won’t be pretty, but it should still show you the values.

Is it still mangled?

HTTP Headers are not UTF-8, they are ISO-8859-1. There is no way to define a different Content-Encoding for headers, and @sdayman has access to whatever encoding he wants in his response body.

I’m sure somebody who understands character encoding better than I do will know what is happening here, but it will be a kludge of some kind.

You could convert the received data back using something like:

% echo "São Paulo" |  iconv -c -t iso8859-15 -f UTF8
São Paulo
1 Like