Click here to Skip to main content
12,695,739 members (32,919 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked

Encoding Accented Characters

, 22 May 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
There is a problem exporting accented characters in plain text files. You need to encode, but which one?


There 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 How

The 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.


Converting the following: Frédéric François.

Encoding Description Output
ASCII Fr?d?ric Fran?ois
Default Frédéric François
UTF7 Unicode (UTF-7) Fr+AOk-d+AOk-ric Fran+AOc-ois
UTF8 Unicode (UTF-8) Frédéric François
iso-8859-1 Western European (ISO) Frédéric François
iso-8859-8 Hebrew (ISO-Visual) Frederic Francois
us-ascii US-ASCII Fr?d?ric Fran?ois
Windows-1252 Western European (Windows) Frédéric François

Example of Code Using Encoding

StreamWriter sw = new StreamWriter
    ("somefile.txt", false, System.Text.Encoding.GetEncoding("iso-8859-8"));

A Full Example for the Beginner

using (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)


  • 22nd May, 2007: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Simon Hughes
Software Developer (Senior)
United Kingdom United Kingdom
C++ and C# Developer for 21 years. Microsoft Certified.

UK Senior software developer / team leader.

I've been writing software since 1985. I pride myself on designing and creating software that is first class. That means it has to be fast, scalable, and with good use of design patterns.

I have done everything from risk analysis and explosion modelling, banking systems, to highly scalable multi-threaded arrival and departure screens in many leading airports, to state of the art wireless warehouse systems.

You may also be interested in...

Comments and Discussions

QuestionEncoding Accented Characters (String) Pin
Member 1056399925-Mar-14 23:39
memberMember 1056399925-Mar-14 23:39 
GeneralDoesn't work for me [modified] Pin
DEGT27-Aug-08 4:15
memberDEGT27-Aug-08 4:15 
GeneralRe: Doesn't work for me Pin
seanicongroup7-May-09 12:18
memberseanicongroup7-May-09 12:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 22 May 2007
Article Copyright 2007 by Simon Hughes
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid