godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.34k stars 21.25k forks source link

GDScript "unknow character" error when using "ñ" character with unquoted NodePath in $ operator #41608

Open phantomdesvin opened 4 years ago

phantomdesvin commented 4 years ago

Godot 3.2.2-stable win 64.

PC, Windows 10 Pro 64

Issue description: GDScript "unknow character" error when using "ñ" character. It worked on previous version. I know it because I was following a course on Udemy in wich the teacher uses a previous version of Godot (probably 3.1), he uses the word "Contraseña" to name a Node and then uses the line: if $VBox/Contraseña.text == "1234": And that doesn't give him any error. When I do the same, but using Godot 3.2.2-stable win 64, I receive the error "unknown character". I understand that many languages don't support that character, but taking into account that it was previously supported, maybe it is a regression.

Steps to reproduce: Use the character "ñ" in GDScript, for example "var leña = 3" and you will receive the "Parse error: Unknown character".

Minimal reproduction project: I think this is not needed in this case.

akien-mga commented 4 years ago

if $VBox/Contraseña.text == "1234":

That doesn't work in Godot 3.1 either.

Are you sure the NodePath wasn't quoted? This works in both 3.1 and 3.2:

if $"VBox/Contraseña".text == "1234": pass
phantomdesvin commented 4 years ago

if $VBox/Contraseña.text == "1234":

That doesn't work in Godot 3.1 either.

Are you sure the NodePath wasn't quoted? This works in both 3.1 and 3.2:

if $"VBox/Contraseña".text == "1234": pass

You are right, I rewatched the course and the teacher used quotations there. I didn't notice because he only used them for that line. Then it is not a regression, sorry. Feel free to delete the issue if you don't consider it a bug.

vnen commented 4 years ago

Probably won't be solved in 3.2 but we are considering allowing Unicode characters in identifiers in 4.0, which would allow for this case. For now you need to use quotes.