|
Answer» I want a batch CODE that would convert my list of text files already SAVED as unicode to ANSI Type.
Any help on this is much appreciated.
Also, I thought a way could be to open the unicode text file and write it to an Ansi text file type, howere not sure if this is the right well because I do have a list of text files, i want to convert to Ansi text file type.
See the code below, it isn't giving me my result though....
echo off
$file = FileOpen("C:\Examplle.text", 0) ; Open for Reading $file1 = FileOpen("C:\Example.text", 1) ; Open for Writing
If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf
If $file1 = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf
While 1 $chars = FileRead($file, 2) If error = -1 Then ExitLoop If ($chars) <> "ÿþ" then FileWrite ($file1 , StringLeft ($chars , 1)) EndIf
Wend
FileClose($file) FileClose($file1)
Many Thanks http://www.robvanderwoude.com/type.php#Unicode http://www.dostips.com/DtCodeSnippets.php#Snippets.UnicodeToAnsiAnd here is a nice little function you can call WITHIN your batch file if you are using a for loop to get a list of your text files you need to convert. http://www.dostips.com/DtCodeCmdLib.php#Function.ToANSI
Quote from: Mat51 on January 08, 2012, 02:35:27 PM See the code below, it isn't giving me my result though....
I'm not SURPRISED. That isn't Windows batch/cmd code - it looks like some language you invented.
Quote from: Salmon Trout on January 08, 2012, 03:34:13 PMI'm not surprised. That isn't Windows batch/cmd code - it looks like some language you invented.
I think it's some kind of BASIC; I'm not sure which, though.
|