1.

Solve : Writing ANSI txt files instead of Unicode????

Answer»

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.



Discussion

No Comment Found