Japanese Hiragana Characters don't work in WebGL?

Hey I made a WebGL build of an app I was working on and noticed only English characters work in the Unity UI.
Japanese characters work in the Editor, PC and Android just fine but NOT WebGL.

Is this a bug?

Unity 5.2.0p1.
Windows 10.
Tested in Chrome and Firefox.

1 Like

Seems to happen with a lot of UTF8 characters. Input boxes seem to misbehave with these as well.

What font did you use for the text components?
To make sure that the font that holds the characters is available, include it into the project end reference it.

Do you have a Font with Japanase Characters included in your project and selected for your UI elements? See http://docs.unity3d.com/Manual/class-Font.html:

I just am using the Unity default font that works on every platform but WebGL I’ve tested.

I just am using the Unity default font ‘arial’ that works on every platform but WebGL I’ve tested.

Here are the settings (nothing special):

The default font on windows is Arial for example.
But unity does not include the Arial font file into the build unless you copy the Arial font file into your asset folder and assign it to the text element.
If the Font is not available on your target platform unity will fall back to another font that is available, if that fallback font does not include the characters yo are targeting you get problems.

Where can I get a Arial font for Unity that supports everything windows does?
Just copy the windows one?

Nope thats not the issue. Downloaded and used a Arial font that works perfect in the Editor but not WebGL.

Did you run into this as well? Know of a workaround

I even downloaded and used a Arial font off the internet that works fine in the Unity Editor but NOT WebGL.
Should I submit a bug report?

mmm ok that sounds like a bug , can you make a example scene that i can test?

Here are live tests: http://reign-studios.net/WebTests/
WebPlayer works, WebGL does NOT (tested in Firefox).

Here is the download link to the Unity project and builds: https://www.dropbox.com/s/51w8z4bw7r12nbh/TestJap.zip?dl=0

Here are live tests: http://reign-studios.net/WebTests/
WebPlayer works, WebGL does NOT (tested in Firefox).

Here is the download link to the Unity project and builds: Dropbox - Error - Simplify your life

Submitted bug report: Case 730040

1 Like

Thanks for repoting.
I did test your setup as provided and with the areal windows font included into the project and linked to the text component, no change , the special characters are still missing in webgl. My guess would be that the way unity writes the files in webgl does not work for extended character sets.

So, this cannot work on WebGL, for the reason I quoted from the docs.

Arial does not contain Hiragana glyphs. When Unity encounters a glyph which is not present in a font it is using, it will fall back to the OS installed fonts to find one which has the glyph. But, In WebGL, it does not have access to the system ttf files, so it cannot do that. So, for it to work, you need to use a font which either actually contains the glyphs you need, or which has specified a fallback font (which needs to also be included in the project) containing the glyphs.

Do you know what Windows font it falls back to? I understand what you’re saying now. Wish Unity came with a font or fonts that had more characters by default. I’ll do some more tests to confirm.

On windows or OS X, it will try the following fonts as fallbacks:

        // Make Arial first fallback for consistency, as it widely available.
        gFontFallbacks->push_back("Arial");
        // Arial Unicode MS covers almost all unicode scripts, and is available on OS X (>=10.5).
        gFontFallbacks->push_back("Arial Unicode MS");
        // This should catch Unicode scripts on Windows, excluding Asian scripts
        gFontFallbacks->push_back("Microsoft Sans Serif");
        // This should catch Chinese on windows
        gFontFallbacks->push_back("Microsoft YaHei");
        // This should catch Korean on windows
        gFontFallbacks->push_back("Gulim");
        // This should catch Japanese on windows
        gFontFallbacks->push_back("MS Gothic");

Be careful what you wish for :slight_smile: The default font shipping with Unity WebGL is intentionally stripped down to a basic latin character set to avoid build size exploding for projects which don’t need this. Arial Unicode, which is pretty complete, is a 23 MB font file (Or still 15 MB compressed). I don’t think that adding that as the default font would help in all those threads about WebGL build size.

1 Like

Ok tnx for the info. Ended up using this font that supports English and Japanese: レトロ系フォント「ほのか新アンティーク角」無料ダウンロード

All is good now :slight_smile:

Was confused on how Unity built out font info. Using this font that directly supports English and Japanese works: http://font.gloomy.jp/honoka-antique-kaku-dl.html