I have a worker that is using fetch to download a URL. The URL body contains strings like für but when I fetch it using the Cloudflare worker I get strings like “f�r akkusativ oder dativ”,
“f�r alina arvo p�rt”,
I have tried setting both accept-type and content-type headers for the request using application/json;charset=utf-8 but still no luck.
Any suggestions or ideas?
Thanks in advance!
Since we don’t know the code of your worker, nor what exactly you are originally fetching, it will be hard to help.
You did not provide an example worker, or its code, nor anything we can reproduce the issue.
But the problem with german umlauts is: if you get them in a different format than UTF-8 and display them in UTF-8 they will look broken, just like the ones you just posted. Helpfully would also by, having the original text in byte-code, as otherwise maybe some translations/conversions are happening on some ends.
Generally speaking: convert the string/json (whatever it is) to UTF-8 before displaying it in UTF-8, or change the charset to what it actually is, so it will be displayed correctly.
Some time ago I used iconv-lite (but not with workers) to convert strings into UTF-8 and preserve umlauts. Dunno if it is helpful or not.
This may be helpful: Encoding · Cloudflare Workers docs
TL;DR - I ended up adjusting the user-agent and its fine, so much be some type of response/encoding based on user-agent. Thanks for the help - much appreciated!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.