Q:

strings not recognizing multilingual characters

So I have this foreign namebank in a textfile that I read from and throw into a data table.
The "string" datatype doesn't recognize the foreign letters. I am using a textreader/streamreader to read the text file line by line (one line per name)
What is in the textfile -> What shows up in the database(traced it to the string)
Szilveszter Kárpáthy -> Szilveszter K�rp�thy
Szalók Szôlôsy -> Szal�k Sz�l�sy
Im using nvarchar, but the mistranslation is happening from the declaration of the name to string. Any ideas to why?

A:

You may want to look at the overload StreamReader(Stream stream, Encoding encoding) if your file is not UTF8 and specify the encoding of the file.
To check if the file is read correctly, put a breakpoint in the code and check the content of the variables before storing them to the database. By doing this you can determine if the strings were decoded wrong from the file or if the encoding error occurs when saving to the database.

