|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThere is a problem exporting accented characters in text files. Some programs cannot import or correctly display accented characters. Therefore you need to use encoding to correctly export a plain text file. However, there are a LOT of encodings, so which one should you use? Here's HowThe answer is: iso-8859-8. That is the Hebrew (ISO-Visual) encoding. The encoding is natively supported in .NET. It intelligently converts to a visual format for you. The other standard encoders do not do this as you will see below. ExampleConverting the following: Frédéric François.
Example of Code Using EncodingStreamWriter sw = new StreamWriter
("somefile.txt", false, System.Text.Encoding.GetEncoding("iso-8859-8"));
A Full Example for the Beginnerusing (StreamWriter sw = new StreamWriter
("somefile.txt", false, System.Text.Encoding.GetEncoding("iso-8859-8")))
{
DataSet1TableAdapters.binsTA ta = new DataSet1TableAdapters.binsTA();
DataSet1.binsDataTable dt = ta.GetData();
foreach (DataSet1.binsRow row in dt.Rows)
{
sw.Write(row.ID.ToString());
sw.Write("|");
sw.WriteLine(row.description);
}
}
History
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||