Page 1 of 1
PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Tue Sep 16, 2025 8:23 pm
by Kurzer
Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description.
Copy the following code into the IDE and press F5
Code: Select all
EnableExplicit
If Hütte = 1
; nothing
EndIf
The message will be:
Line 3: Variables must be declared for ‘EnableExplicit’; H.
If you wrote Hutte instead of Hütte, the message would be correct:
Line 3: Variables must be declared for ‘EnableExplicit’; Hutte.
Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Wed Sep 17, 2025 8:17 am
by mk-soft
I find it as no bug, but a rule in the programming that no special characters may be used (ÄÖÜ, etc)
This is not only the case with PureBasic
Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Wed Sep 17, 2025 8:34 am
by Little John
mk-soft wrote: Wed Sep 17, 2025 8:17 am
but a rule in the programming that no special characters may be used (ÄÖÜ, etc)
This is not only the case with PureBasic
That's not what he reported as a bug.
The reported bug is the faulty error message.
Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Wed Sep 17, 2025 9:47 am
by Fred
It might be a bit confusing, but the error is correct as 'ü' is not a valid char for a variable, so the parser stop at it. It then check if the variable exists ('H') and then raise the error. If EnableExplicit is not set, then a syntax error is raised because it tries to go further with the H variable and find an invalid character.
Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Thu Sep 18, 2025 8:47 pm
by Kurzer
I can understand the explanation on a technical level...
If the parser stops nicely at the “ü” and the supposed variable ‘Hütte’ is only marked internally as “H,” then the error output has virtually no choice but to output “H.”
...but it may be confusing for inexperienced users if only the first letter is displayed.
And if you declare the variable correctly or omit EnableExplicit, you get error messages that don't point to the actual problem but mislead the user:
Code: Select all
If (Hütte = 1 And Wind = "High") Or (Rain = #True And Umbrella = 0)
; nothing
EndIf
Will result in:
Line 1: “)” expected!
Will result in:
Line 1: Syntax-Error
And here too (even if it sounds a bit nitpicky): What actually sounds like a correct error description could unsettle an inexperienced user if hi expect that “Syntax error” means hi have written a command incorrectly. In my opinion, if a variable name is used incorrectly, it should be pointed out that the name of the variable does not comply with the conventions.
E.g.: “The variable name ‘Hütte’ contains invalid characters.”
But as I said, I can understand the explanation on a technical level, and I don't know how complicated it would be to extract the variable name completely despite the use of incorrect letters or characters for the error message.
Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description
Posted: Fri Sep 19, 2025 5:11 pm
by Sicro
Kurzer wrote: Thu Sep 18, 2025 8:47 pm
E.g.: “The variable name ‘Hütte’ contains invalid characters.”
I think that would also be good and possibly easier to implement:
"Error: Invalid character at: line 1, pos 11"
or
"Error: Invalid token at: line 1, pos 10"