Hi, I am having an issue where special characters are diplayed incorrectly.

I use this function to return the full ADSPATH:

 Code:
	$UserName = "yourtestaccount"
	$UserAccountOU = GetUserOU($UserName + "@@yourdomain.com") 
	Function GetUserOU($UserName) 
		$aAttributes = "Name", "AdsPath"  
		$sADsPath = "LDAP://"+GetObject("LDAP://domain.com").Get("defaultNamingContext")  
		$strFilter = "(&(objectClass=User)(userPrincipalName=$UserName))"  
		$aResults = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")  
	;	@ERROR " | " @SERROR ?  
		For $c = 0 to Ubound($aResults) 
		    For $r = 0 to UBound($aResults,2) 
		      $GetUserOU = $aResults[$c,$r]
		    Next 
		Next 
	EndFunction

Then I remove the "LDAP:\\" from the string, because I want to use DSQUERY:

 Code:
	$UserOU = SubStr($UserAccountOU, Len("LDAP://")+1, Len($UserAccountOU)-Len("LDAP://")) ; remove "LDAP://" from string


Then I generate the following command file:

 Code:
	If Open(1,"Test.cmd",5) = 0
		WriteLine(1,'@@echo off' + @CRLF)
		WriteLine(1,'dsquery user -name ' +chr(34) + '$UserName' + chr(34) + ' ' + chr(34) + $UserOU + chr(34) + @CRLF)
		WriteLine(1,'exit 0' + @CRLF)
	EndIf
	Close(1)
	Shell '%comspec% /C Test.cmd'

So far it works OK.

For the purpose of this test, we will use:

 Code:
CN = Francis Bossé
UserName = fbosse@domain.com

Now strange things happen.
If I run the generated command file, I get this error:

 Code:
	dsquery failed:Directory object not found.
	type dsquery /? for help.

So I said allright, lets check the content of the command file.
I do a type of the command file, I see:

 Code:
	dsquery user -name "Francis BossÚ" "CN=Francis BossÚ,OU=LAPTOP,OU=CITY,OU=USERS,DC=domain,DC=com"
	exit 0

I open the command file from notepad, I see:

 Code:
	dsquery user -name "Francis Bossé" "CN=Francis Bossé,OU=LAPTOP,OU=CITY,OU=USERS,DC=domain,DC=com"
	exit 0

I don't understand how I can produce different results from the same text file...
I suppose when I run the command file, it is read in the same format like the TYPE command?
Is there a way to fix this ? (please don't tell me not to use é in the name ;\) )