Search
  You are here: Tech Blog Register   Login  
Creating Text Files with My.Computer.FileSystem.WriteAllText
Location: BlogsAll Things Tech    
Posted by: host 12/29/2006 5:50 PM
UTF-8 encoding on my text fileToday I was having trouble with a simple text file receiving 3 characters at the beginning of the file.  After checking to make sure none of my output strings contained the characters, I started checking the methods use to write the file.  Sure enough, I had forgotten to change the default encoding (Encoding.UTF8) to Encoding.ASCII.  After changing my method parameters, the file came out clean and ready to use.

Example code:
My.Computer.FileSystem.WriteAllText("c:\myfile.csv", content.ToString, False, System.Text.Encoding.ASCII)
Permalink |  Trackback

Your name:
Title:
Comment:
Add Comment   Cancel 
 

Other things you might like...
 

All Things Tech... Mostly
 

Blog Search
 

All Things Tech... Mostly
 

Copyright 2007 by SummerWorks.us Terms Of Use Privacy Statement