FileInfo.CreateText and encoding

Mental note to self:

Normally the StreamWriter class will use UTF-8 encoding, unless specified otherwise. You will have to use one of the special constructors to do so. Using FileInfo.CreateText will give you a StreamWriter, but it will have an ANSI encoding.

Remember this for the next time. Quick ways are sometimes expensive ways. Use the special constructors and a FileStream object. 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s