Computer Hope
Microsoft => Microsoft DOS => Topic started by: 99miles on May 24, 2006, 10:23:01 AM
-
I have a batch file that exports some registry keys and values to a text file. Then I need to read the text file in via PHP, but the batch file writes the text file in Unicode, and PHP 5 doesn't support Unicode (I can't switch to PHP6).
Is there a way to get the batch file to write in ANSI, or... any other ideas? THanks!
-
what commands did you use to export the registry?
-
I'm just using:
@REG EXPORT %RegKeyLocation% textfile.txt
thanks
-
If you have WinXP or 2000, just run the file thru the type command:
type Unicode.txt > ASCII.txt
Also check to see if your version of the copy command supports the /a switch. You may be able to use that on the output side of the command.
8-)
-
99miles,
The TYPE example provided by Sidewinder works correctly when CMD.EXE runs in ANSI mode. To make sure it does run a new instance with the /A switch like this:
cmd [highlight]/A[/highlight] /c type textfile.txt>ansifile.txt[/b]
Similary you can convert an ANSI file to UNICODE:
cmd [highlight]/U[/highlight] /c type textfile.txt>unicodefile.txt[/b]
Ref:http://dostips.cmdtips.com/DosCommandRef.htm#cmd
Hope this information is useful. ;)