How to get i18next-node to display umlauts correctly?

I searched around quite a bit, but could not find a solution to my problem.

My application uses i18next and it works fine, except for one problem: German umlauts (ΓΌ, ΓΆ, Γ€) is displayed as.

I don’t understand if this was wrong, because in this example application there are no problems with umlauts: http://i18next-example1.eu01.aws.af.cm/?setLng=de-DE (github: https: // github .com / rbeere / i18next-jade-express-sample )

How can I understand that?

+1
internationalization express i18next
source share
1 answer

The fault may be:

  • Translation.json file is not saved as UTF8.
  • If any particular fonts are used, their Unicode support is very limited (this is very unlikely with modern fonts).
  • layout.jade file does not declare the page encoding. Therefore, the browser will automatically detect it. Regardless of whether the problem resolves or not, it is recommended to declare the page encoding in the header:

     meta(http-equiv="Content-Type",content="text/html; charset=utf-8") 
  • Content-Type The HTTP header field is not set correctly. Modify the HTTP response as follows:

     app.get('/', function(req, res) { res.header("Content-Type", "text/html; charset=utf-8"); res.render('index', { title: 'Localization with Express, Jade and i18next-node'}); }); 
+4
source share

All Articles