Enabling unicode in html5 builds

I’m writing a small quiz game for the browser. The problem I’m getting is that the Japanese characters aren’t rendering in browser (HTML5 build).





I’m using Japanese characters in my code like so

private Dictionary<string, string> quiz_answers = new Dictionary<string, string>(){
	{"a", "ア"}, {"i", "イ"}, {"u", "ウ"}, {"e", "エ"}, {"o", "オ"}

I’ve tried converting them to unicode characters but I think it doesn’t change anything.


I had the same problem.

It turned out that the font I was using didn’t support the special characters I was using. It worked nontheless in the editor and in PC-builds, because in these cases Unity uses a different fallback-font to render the special characters. But in WebGL-builds, Unity can’t access these fallbacks:

From Unity - Manual: Font assets

Note that some target platforms
(WebGL, some consoles) do not have OS
default fonts Unity can access for
rendering text. […] All
fonts to be used as fallbacks must be
included in the project, so if you
need to render international text or
bold/italic versions of a font, you
need to add a font file which has the
required characters to the project […]

To find a font that supported the special characters I needed, I used the Windows character map (Press Windows-key + R, then type “charmap”) as well as pages like Unicode Character 'LEFT RIGHT DOUBLE ARROW' (U+21D4)

I found a font that had everything I needed, and I am using that font as my main font. You can use the font as a fallback-font instead, just read the first page I linked to.

The Unity manual also says:

Note that fonts are subject to copyright and you should only include fonts that you have licensed or created for yourself.
It can be hard finding a completely free font that support some special characters. If so, you have to pay for a license (even fonts like Arial requires a license when embedded in applications)