+2 votes

Hello everybody,

I have a story made with other software (test with excel, textedit, twine...), I'm on Mac.

I copy/paste my story in a array into Godot.
Problems are accents !
enter image description here

When I correct in editor something strange happened :

video here

I don't know what to do.
I tried to format the story in plein text and past it but doesn't work either !
I have to manually correct all accents...

If someone have a better solution
Thanks in advance.

Godot version 3.32
in Engine by (209 points)

Can you show some code what the paste looks like?

Sur,

Initial text formatted in excel :
["D'ailleurs où êtes vous ?",6,"La porte au fond du couloir",7,"La porte en bois clair",4,"La porte sombre",3,],
[and so on...]

Pasted in Godot:
var story = ["D'ailleurs où êtes vous ?",6,"La porte au fond du couloir",7,"La porte en bois clair",4,"La porte sombre",3,],

Output in game :
D'ailleurs ou' e ^tes vous ?

Thanks.

Does the font used in the project (not the editor) have the required characters? The default project font doesn't support much outside the plain ASCII range.

1 Answer

0 votes
Best answer

Your problem will be related to the character codes. The basic set is ASCII and uses 1 byte per character as used by the Label Node, but for extended text characters we need multi-byte text which is usually encoded with UTF-8 and used with the Rich Text Label.

And you probably want to install a Font to support the extended characters that you want to display.

by (191 points)
selected by

I don't see the problem when I copy/paste your code:

var story = ["D'ailleurs où êtes vous ?",6,"La porte au fond du couloir",7,"La porte en bois clair",4,"La porte sombre",3,]

func _ready() -> void:
    for s in story:
        print(s)

here is the output

--- Debugging process started ---
Godot Engine v3.3.2.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce GT 650M OpenGL Engine
OpenGL ES Batching: ON

D'ailleurs où êtes vous ?
6
La porte au fond du couloir
7
La porte en bois clair
4
La porte sombre
3

Thanks a lot.
It's already a Rich Text Label.
Here a screen of code / console / game :

enter image description here

The RichTextLabel has some CustomFonts properties. In the Inspector, you need to set up Dynamic Fonts for at least the Normal Font. This entails creating a Dynamic Font Resource and specifying a .ttf (True Type) Font that you have in your project. You will have to find one on your computer or download one to match the character set that you want. Also, be aware of license conditions for using the fonts in your published work.

Thanks for replying me, I'm going to try.
I'll tell you the results.
Have a nice day.

Hello,
My font is already set dynamically :

$text.add_font_override("normal_font", dynamic_font)

As you said, I try changing the font, and it's ok, no more spaces or stranges accents.
But...
When I switched to the previous not working font, no more pb too, everything go back to normal... really strange.

Changing the font resolve the pb.
Thanks for your help.

Have a nice day !!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.