Streamwriter + WriteLine UTF8

I am using a streamwriter object to write lines of text to a text file, the problem is when the file is being received by a third party they are saying it is in UTF8 format, I need it to be in ascii, how do I change it?
rocky050371Asked:
Who is Participating?
 
abelCommented:
When you create the StreamWriter, you can give it an encoding, that should do the trick:

'// create sw with special enc '
StreamWriter sw = new StreamWriter(File.Open("path-to-file", FileMode.Open), Encoding.ASCII);
 
' thats it '

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.