PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 688
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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.
PB 6.12 x64, OS: Win 11 24H2 x64, Desktopscaling: 150%, CPU: I7 12700 H, RAM: 32 GB, GPU: Intel(R) Iris(R) Xe Graphics | NVIDIA GeForce RTX 3070, User age in 2025: 57y
"Happiness is a pet." | "Never run a changing system!"
User avatar
mk-soft
Always Here
Always Here
Posts: 6270
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Little John
Addict
Addict
Posts: 4798
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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.
Fred
Administrator
Administrator
Posts: 18301
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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.
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 688
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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!

Code: Select all

Global.i Hütte
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.
PB 6.12 x64, OS: Win 11 24H2 x64, Desktopscaling: 150%, CPU: I7 12700 H, RAM: 32 GB, GPU: Intel(R) Iris(R) Xe Graphics | NVIDIA GeForce RTX 3070, User age in 2025: 57y
"Happiness is a pet." | "Never run a changing system!"
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 561
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: PB 6.21 x64: Invalid variable names with umlauts are truncated after the umlaut in the debugger's error description

Post 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"
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Post Reply