Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Writing ANSI txt files instead of Unicode???  (Read 5434 times)

0 Members and 1 Guest are viewing this topic.

99miles

  • Guest
Writing ANSI txt files instead of Unicode???
« 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!

ghostdog74



    Specialist

    Thanked: 27
    Re: Writing ANSI txt files instead of Unicode???
    « Reply #1 on: May 24, 2006, 10:50:40 AM »
    what commands did you use to export the registry?

    99miles

    • Guest
    Re: Writing ANSI txt files instead of Unicode???
    « Reply #2 on: May 24, 2006, 11:00:47 AM »
    I'm just using:

    @REG EXPORT %RegKeyLocation% textfile.txt

    thanks

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Writing ANSI txt files instead of Unicode???
    « Reply #3 on: May 24, 2006, 03:12:22 PM »
    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-)

    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    DosItHelp



      Intermediate
      Re: Writing ANSI txt files instead of Unicode???
      « Reply #4 on: May 24, 2006, 09:24:51 PM »
      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. ;)

      « Last Edit: May 24, 2006, 09:25:53 PM by DosItHelp »