Page 1 of 1

Error handling ENV-variables containing é

Posted: Tue Apr 17, 2007 6:46 pm
by AND51
Hello!

When executing this code:

Code: Select all

If ExamineEnvironmentVariables() 
  While NextEnvironmentVariable() 
    Debug EnvironmentVariableName() + " = " + EnvironmentVariableValue() 
  Wend 
EndIf 
I noticed that there are some Environmentvariables that contain an é in it's value:
Debugger wrote:ALLUSERSPROFILE = C:\Dokumente und Einstellungen\All Users
APPDATA = C:\Dokumente und Einstellungen\Andr‚\Anwendungsdaten
CLIENTNAME = Console
CommonProgramFiles = C:\Programme\Gemeinsame Dateien
[...]
USERNAME = Andr‚
USERPROFILE = C:\Dokumente und Einstellungen\Andr‚
windir = C:\WINDOWS
As you might have noticed: è is replaced by comma, so in fact it must be "André" instead of "Andr,"...

Is this an error 'made by Windows'? I have seen some other programs (not made in PB) who also have this error, those programs always try to write into the wrong path => so they create a directory named "Andr,".

Any ideas?

Re: Error handling ENV-variables containing é

Posted: Tue Apr 17, 2007 6:55 pm
by Kaeru Gaman
AND51 wrote:Any ideas?
don't (no don't, I mean do not never ever, under no circumstances) use extra-chars in environment-variables.

stick to Chr(65)-Chr(90) and Chr(48) - Chr(57) for the sure side.
in earlier days, (environment)variable-names could not begin with a number,
so, when you stick to the basic 26 capital letters, all will be fine.

it maybe seem stoneage for you, but then just be glad you can use a Space-char in filenames longer than 8 places.

Posted: Tue Apr 17, 2007 7:28 pm
by AND51
I know what you want to say but if windows offers me to choose a username with special chars, why shouldn't I use this offer?

My name, André, appears correctly everywhere: in startmenu (XP), when using GetUserName_(), in my/other programs, ... but not in these envirnomentvariables.

Posted: Tue Apr 17, 2007 7:29 pm
by Trond

Code: Select all

I know what you want to say but if windows offers me to choose a username with special chars, why shouldn't I use this offer?
Because it gets you into trouble with enviroment variables. :wink:

No seriously, it should work.

Posted: Tue Apr 17, 2007 7:37 pm
by AND51
I'm not the onliest one using special chars...

> No seriously, it should work.
But it doesn't. Furthemore, I've seen other programs, too, having exactly this problem. Before I started coding in PB I wondered why there is always a directory named "Andr,"... Now I know why. Well, is this a problem in windows, then?