Search Unity

UTF-8 for Input field

Discussion in 'UGUI & TextMesh Pro' started by congty3Dart, Feb 18, 2019.

?

How to get utf-8 text to input field Unity

  1. bad

    7 vote(s)
    43.8%
  2. good

    9 vote(s)
    56.3%
  1. congty3Dart

    congty3Dart

    Joined:
    Nov 17, 2018
    Posts:
    5
    I building a app chat, and I come from Vietnam. But Input field in Unity dont show Vietnamese text. How I can get text from Input field is utf-8 text.

    sample Vietnamese text " Xin chào tất cả mọi người!". ( It mean "Hello everyone").

    I'm not a native English speaker, so I'm sorry for every mistake.
     
    junnochankr likes this.
  2. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    121
    The reason it doesn't show Vietnamnese characters is because they're not included in the font asset that you're using. You must make your own font asset that explicitly includes the Vietnamnese characters that you need in your game. Here's the documentation that explains how to do it: http://www.digitalnativestudios.com/textmeshpro/docs/font/

    Since you're making a chat you should also check out this new feature: https://forum.unity.com/threads/ver...mic-sdf-for-unity-2018-3-now-available.622420
    It generates missing characters automatically while the game is running. This is very useful for a chat so people can talk in any language they want even if you did not include the characters (Chinese, Korean...) in your font asset.
     
    KCBM_MITI likes this.
  3. congty3Dart

    congty3Dart

    Joined:
    Nov 17, 2018
    Posts:
    5

    Thank for answer, In fact, I building a Chatbot, that get input in the Input field and compare with clause in xml file (utf-8) and show clause output.
    In Textmesh pro I try 02 - Multi-line TextMesh Pro. I've edited
    Code (CSharp):
    1. Em oi, em có bu?n không? <#ff8000>D? ngã d?y</color>
    2.  
    but, I want it be:
    Code (CSharp):
    1. Em ơi, em có buồn không? <#ff8000>Dạ ngã đây</color>
    2.  
    you can get app write Vietnamese with link: http://unikey.vn/vietnam/
     
  4. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    121
    1.) Download a font that supports the character set you wish to use. For example, "Noto Sans" (free) includes Vietnamnese characters : https://www.google.com/get/noto/

    2.) Open "Font Asset Creator" window in Unity and follow the steps from this video (but you need to choose a custom character set not ASCII):


    3.) Assign your newly created font asset in your TextMeshPro component.
     
    congty3Dart likes this.
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If you are using Unity 2018.3 or above, you should install version 1.4.0-preview.2a of TextMesh Pro using the Unity Package Manager (see the following post and video)

    This new version of TextMesh Pro includes Dynamic SDF support where it won't be necessary to add the needed characters to the font asset (ahead of time) via the Font Asset Creator. Instead the needed characters / glyphs can be added dynamically to a newly created font asset in the Editor or at Runtime.

    The Dynamic SDF system doesn't replace the need for the Font Asset Creator and using Static font assets but that's a discussion for another day / post which is also explained in the sticky post linked above.

    You will still need to create a font asset from a font file that contains the Vietnamese character set.

    Here is an image using this latest version of TextMesh Pro in Unity 2018.3 using Arial.

    upload_2019-2-20_0-30-52.png

    Does this render correctly?

    I added the red arrow to bring attention to the use of diacritical marks which is not fully supported yet in TextMesh Pro. Until proper support for Diacritical marks is added to TMP, you can use / define Glyph Pair Adjustments in the Glyph Adjustment Table.
     
    HungHuu82 likes this.
  6. KimiKyron

    KimiKyron

    Joined:
    Feb 20, 2019
    Posts:
    1
    Hi @congty3Dart @congty3dartvn, have you been able to solve this problem? I am finding a solution for this as well. Please help!
     
  7. thunguyen177

    thunguyen177

    Joined:
    Aug 11, 2020
    Posts:
    2
    This is a simple way to generate fonts in other languages in Unity

    Or view the tutorial in Vietnamese instead:
     
  8. HungHuu82

    HungHuu82

    Joined:
    Mar 30, 2013
    Posts:
    2
    Hi, i have a same problem here, using default Arial font but it not display correctly, Still not work when build to app and test on another devices.
    Please help. 73FAD6F7-C9A9-41DA-BB62-FFE707F139B4.png
     
  9. Dekata

    Dekata

    Joined:
    May 20, 2016
    Posts:
    47
    The issue still not fix, at the arrow point i only get character when paste it to TextMesh Input Field.
    upload_2021-2-4_11-49-6.png
    the "?" when typing "ộ". Can you suggest a solution for this?
     
  10. junnochankr

    junnochankr

    Joined:
    May 20, 2021
    Posts:
    1
    You can use js Mudim library like this HTML site is using: Vietnamese Typing Online
     
  11. HydrozenZero

    HydrozenZero

    Joined:
    Sep 27, 2018
    Posts:
    1
    If you want to enter directly without showing "?".
    Please disable Unikey and enable Vietnamese Telex percussion in Windows settings.
    I was looking for this way while playing the game Genshin Impact.
     
    diffcat and Dekata like this.
  12. ankitshivam734

    ankitshivam734

    Joined:
    Mar 19, 2022
    Posts:
    1
    Hello i am getting white space issue when using mobile emoji in RTL input field
     
  13. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    772
    I still having this issue I just want to make TMP support all language this is possible?
     
  14. vuquangdai9x

    vuquangdai9x

    Joined:
    Dec 27, 2018
    Posts:
    1
    If you're using Vietnamese IME like Unikey, try to enable the option "Always use clipboard for unicode". It's worked for me since I haven't encountered the bug that show '?' when I tried to type Vietnamese characters. upload_2022-7-5_14-0-28.png
     
  15. thankhuya4

    thankhuya4

    Joined:
    May 29, 2022
    Posts:
    4
    you should try unity 2022. I get the same problem and all i need is update version from 2021.1.1.19f to 2022.1.17f.1.
     
    SeleneCaro likes this.