Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Ordosx · Aug 06, 2012 at 10:11 PM · guicharactersutf-8

UTF-8 for foreign language characters on GUI

My project has some foreign characters like "á" or "ñ" but the GUI does not display them.

I guess is because the mMnodevelop Editor tool that came along with unity is not encoding my scripts with UTF-8.

Well I'm unable to find a way to do so, I check all the options in the editor and I couldn't find it, can somebody please point it out for me?

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Kryptos · Aug 07, 2012 at 09:33 AM

Unity does not use UTF-8 but UTF-16. There is an option in Monodevelop to set the default character encoding (don't remember where).

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ordosx · Aug 07, 2012 at 11:23 AM 0
Share

Thanks for the answer, but some issues remain :( If I use the guiSkin tip from afromofu It works as soon as I set the text in my script, but it still doesn't work with text that I bring from an X$$anonymous$$L file.

I create the xml with notepad++ so I sure I encode it with UTF-8 (besides the headline of the file is ), so I guess the problem is in the way I read the xml file.

$$anonymous$$y code is like this:

var xmlDoc : XmlDocument = new XmlDocument();

var ta : TextAsset = Resources.Load(persistentSc.textsFile);

xmlDoc.LoadXml(ta.ToString());

var nodes: XmlNodeList = xmlDoc.SelectNodes("tutorial");

...

var aux : String;

aux = nodes[0].SelectSingleNode("text").InnerText;

By now aux already has no foreign characteres so I guess the problem could be in "ta".

Any help?

Thanks!

avatar image Kryptos · Aug 07, 2012 at 12:14 PM 1
Share

Like I said UTF-8 is not fully supported. You have to encode your file with UTF-16. In Notepad++ this will be UCS-2 Little Endian.

avatar image Ordosx · Aug 07, 2012 at 12:19 PM 0
Share

YES!, that works! Thanks a lot $$anonymous$$ryptos!

avatar image Eric5h5 · Aug 07, 2012 at 02:23 PM 0
Share

Depends on what language you're using...UTF-8 works fine for Unityscript, but not C#.

avatar image
0

Answer by afromofu · Aug 07, 2012 at 02:29 AM

Here is how I did to use Unicode for GUI in my projects.

  • Create a GUISkin and set your font in 'Font'.

  • Use the GUISkin in OnGUI. Look at the code below.

Like this:

  public GUISkin guiSkin; // for in case you want to set it in your editor
  void OnGUI()
  {
      GUI.skin = guiSkin;
 
      // GUI.Label(new Rect(10.0f, 400.0f, 500.0f, 500.0f), "something");
  }

If it doesn't work, select the font you're using and set 'Unicode' in the 'Character' property.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

degrees celcius symbol in unity 2 Answers

Allow specific characters on GUI textField? 1 Answer

Umlaut shown as ?? in GUILayout.Button 3 Answers

Make accented letters show in text field on Android? 2 Answers

Question about foreign language characters on GUI 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges