Last active
December 16, 2015 10:59
-
-
Save pparadis/5424127 to your computer and use it in GitHub Desktop.
Encoding UTF-8 to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var fs = new FileStream(@"c:\frenchcoding\frenchencoding.csv", FileMode.OpenOrCreate, FileAccess.ReadWrite)) | |
{ | |
var preamble = new UTF8Encoding(true).GetPreamble(); | |
fs.Write(preamble,0,preamble.Count()); | |
var byteArrayLine1 = System.Text.Encoding.UTF8.GetBytes("courriel, nom, prénom"+Environment.NewLine); | |
fs.Write(byteArrayLine1, 0, byteArrayLine1.Count()); | |
var byteArrayLine2 = System.Text.Encoding.UTF8.GetBytes("pascal.paradis@gmail.com, Paradis, Pascal"); | |
fs.Write(byteArrayLine2, 0, byteArrayLine2.Count()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment