Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Convert ANSI txt file to UTF-8 txt file

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50788
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Convert ANSI txt file to UTF-8 txt file
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Convert ANSI txt file to UTF-8 txt file - 8/16/2007 1:28:18 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
Hi,

I'm working on the following script to convert ANSI to UTF-8, at present the below works for ASCII to unicode,
any ideas how to alter this for ANSI to UTF-8

thanks

' working for ASCII to Unicode
Const ForReading = 1
Const TriStateTrue = -1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\cmc\VBscript\test33.txt", ForReading,False,TriStateTrue)
strText = objFile.ReadAll
Set objFile = objFSO.OpenTextFile("c:\cmc\VBscript\test45.txt", ForWriting,False,TriStateTrue)
objFile.WriteLine strText

objFile.Close
Wscript.Echo strText
 
 
Post #: 1
 
 RE: Convert ANSI txt file to UTF-8 txt file - 8/16/2007 2:09:26 AM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi cmc,

you can't use the FileSystemObject for that; an ADODB.Stream may do what you want:


      

(in reply to cmc)
 
 
Post #: 2
 
 RE: Convert ANSI txt file to UTF-8 txt file - 8/16/2007 2:25:26 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
Thanks ehvbs, thats perfect

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: Convert ANSI txt file to UTF-8 txt file - 8/16/2007 2:49:51 AM   
  cmc

 

Posts: 13
Score: 0
Joined: 5/30/2007
Status: offline
ehvbs,

to read an convert an entire file, do I alter your script with the OpenTextFile in some way.

(in reply to ehvbs)
 
 
Post #: 4
 
 RE: Convert ANSI txt file to UTF-8 txt file - 8/16/2007 3:12:46 AM   
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline

      

//Modified: DM - removed weird formatting tags that appeared in code area.

< Message edited by dm_4ever -- 11/2/2007 1:04:43 AM >

(in reply to cmc)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Convert ANSI txt file to UTF-8 txt file Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts