Error handling ENV-variables containing é

Windows specific forum
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Error handling ENV-variables containing é

Post 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?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: Error handling ENV-variables containing é

Post 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.
oh... and have a nice day.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post 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?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Post Reply