[SOLVED] aurelia-i18n encoding issue


#1

I’m having an issue with utf-8 extended characters being rendered as �. I’m developing with .Net Core 2.2 using Microsoft.AspNetCore.SpaServices. I’m using webpack 4.27.1 to bundle my app. I have saved my project files so that they are encoded as UTF-8. I have also confirmed that meta charset=“utf-8” is properly set in the header of my *.cshtml file which hosts my Aurelia app.

As a test I have added a static web page to my application and it can render extended characters just fine locally and when the app is published to Azure.

rendered_correctly

What am I missing?


#2

Are you sure the JSON translation files are saved using UTF8? Also make sure your index.html uses the Meta attribute

<meta charset="utf-8" />

#3

Yeah, positive. I’ve save then with the appropriate encoding via VS Code. And as I stated in my original post, I have set the <meta charset="utf-8" /> tag in my Index.cshtml file.


#4

Are you loading the JSON files via xhr Backend? If so take a look into devtools Network tab to see in which format they arrive. We need to figure out whether its a Server or Frontend issue


#5

I figure out the problem. It appears that somehow my ES translation file was double encoded – I’m guessing. I noticed in VS Code that even though my file was encoded properly as UTF-8, I was still seeing the � characters.


I refreshed the translation file with fresh data and the extended characters started to be displayed.

Thanks for engaging me on this issue. Your suggestions pushed me to reexamine my translation files.

:slight_smile:


#6

I cant tell you how often I had a similar issue, glad you’ve resolved it