Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Streamwriter + WriteLine UTF8

Posted on 2009-04-22
Medium Priority
Last Modified: 2012-05-06
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?
Question by:rocky050371
1 Comment
LVL 39

Accepted Solution

abel earned 2000 total points
ID: 24206098
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


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question