Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Debug.Log text with letters with accents (é, è, à ...)

Discussion in 'Scripting' started by VallMont, Jun 10, 2019.

  1. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Well, I am working on a program and I need to display string texts with characters like letters with accents for example (é, è, à ...)

    But when I use Debug.Log to check the strings out, those characters are replaced by something else like "?". And I want to be able to display every character from those strings, not only in Debug.Log, but also on my scene.

    For instance, you have the word "élément". For one, when I use Debug.Log, it displays "?l?ment". And I want Debug.Log to display "élément". For two, I don't want to rewrite this string as "element" because I don't have the choice.

    Any idea on how to get past this?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,991
    works for me
    upload_2019-6-10_18-49-28.png
    (tested on pc, 2019.3.0a4)
     
  3. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    Yeah, accented letters are a problem. They can work on some computers and not on others. What about using synonyms that do not have accented letters? What do you mean when you say that you don't have the choice?
     
  4. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Because I get the strings from reading a csv file that I do not get to modify.

    I tried this on 2019.1.2f1 on Windows 7 Pro. It does not seem to work for me.

    What did you write (what's the code) to get this result?

    Edit : that's somehow strange since I'm doing Debug.Log on v2018.3.3f1 on Windows 10 Family, and I don't have a problem either.
     
    Last edited: Jun 10, 2019
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,991
    ok, then you need to save that csv file into utf8.

    can do that with notepad too, in save as dialog:
    upload_2019-6-10_21-43-35.png
     
  6. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Thanks. I'll try it out whenever I can.
     
  7. VallMont

    VallMont

    Joined:
    Feb 6, 2019
    Posts:
    16
    Well, it looks like it was the .csv that was encoded in ANSI. After re-encoding it into utf-8, I can read the characters with accents and display them in Unity.

    Thanks, mgear and APSchmidt.
     
  8. NicolasSouza-NIckSDev

    NicolasSouza-NIckSDev

    Joined:
    Jun 9, 2017
    Posts:
    7
    i´m with a similar probem too, but on my Case it´s with Users with name Liake "João" where the Windows basically forces to sync account and get name taht way....
    so when I Put Application.temporaryCachePath, on Debu.Log returns JOO~1 .... if i create a directory there it´s ok, it creates on right folder, but when use the result to Move or create some file so this become a problem
     
  9. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,869
    That's a completely different problem, you should make your own thread about it. Filenames on Windows have a different encoding scheme and some characters get mangled. That has nothing to do with CSV encoding or Debug.Log's expected string encoding.