Search code examples
character-encodinggodot4

Encoding characters correctly in a Godot Project exported for Web


So I've uploaded a game on itch.io. This is the link to the game in case anyone has to check it.

Inside the SETTINGS, there's an option to change the game language. The first time I uploaded it to itch.io, all the Japanese texts where broken, because of a bug known in Japanese as "mojibake": when the software doesn't know the right character-encoding of your text, it may show weird characters in its place instead.

Usually we fix this in webpages by adding a <meta charset="utf-8"> inside the HTML file, but since this didn't work for my Godot game, I've tried a fix suggested by this video and added a custom font project-wide (Project settings > GUI Themes > Custom Fonts); this time, the font can't deal with the accented Portuguese alfabets (such as á and ê).

I don't know why but this bug only affects the web export of the project, not the Android export (.apk) or the Windows export (.exe).

So what's the best approach to take here?


Solution

  • Someone else has suggested me (in the Japan Godot forum) to use a Google font, because it has both Japanese and accented alfabet character-sets. It fixed my bug. I would still accept another answer as the correct one if someone knows how to fix it without forcing the use of a specific font.