godot4 - Encoding characters correctly in a Godot Project exported for Web - Stack Overflow

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

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?

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?

Share Improve this question asked Nov 19, 2024 at 20:34 Gui ImamuraGui Imamura 72212 silver badges33 bronze badges 2
  • No idea whether relevant, but your <meta charset...> is specific to HTML 5, guaranteed by <!DOCTYPE HTML>. – Joop Eggen Commented Nov 19, 2024 at 22:47
  • @JoopEggen Itch.io automatically creates that declaration on the top of the HTML file and I don't think I can edit that. Nonetheless, wouldn't the game itself be affected by that as well? – Gui Imamura Commented Nov 20, 2024 at 1:10
Add a comment  | 

1 Answer 1

Reset to default 0

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742399998a4436719.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信