There is no such encoding, "Unicode". Core part of Unicode standard does not define any computer presentation, but UTFs define some. None of the UTF's are called "Unicode", but this absurd and confusing word in dirty Microsoft jargon means "UTF-16LE". This UTF is not the most used in files, but it corresponds to the UTF for internal representation of strings in memory. For files, UTF-8 is more typical. Very usually, concrete UTF can be determined by BOM. Please see:
http://unicode.org/faq/utf_bom.html[
^].
This is the universal code in case BOM is used (absent BOM will be treated as ANSI):
using (StreamReader reader = new StreamReader(fileName, true)) {
string line = reader.ReadLine();
}
Please see:
https://msdn.microsoft.com/en-us/library/7bc2hwcb%28v=vs.110%29.aspx[
^].
Sometimes, UTF is used without the BOM. In such pathological cases, try out different encodings from this list:
https://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.110%29.aspx[
^].
What if the encoding is not Unicode one? Then take a guess and try something else. Here is the quick way: rename the file to .HTML, open with the browser and use its auto-detection feature, if you know the language.
—SA