Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading different languages text from a file

Status
Not open for further replies.

SulikSlayer

Programmer
Nov 16, 2002
17
KG
When I use a StreamReader to read a Russian text from a file - id doesn't read it, leaving a blank string. I suppose it happens because there has to be a Russian encoding installed somewhere in msdevenv, so how do I do it?
 
The StreamReader has a "CurrentEncoding" property. You might want to make sure it's being set to System.Text.UnicodeEncoding()

Chip H.
 
1) This is a read-only property.

2) System.Text.UnicodeEncoding() is a constructor of a class System.Text.UnicodeEncoding, so it doesn't return any value. It will work only in an expression like
CurrentEncoding = new System.Text.UnicodeEncoding();
as it will create a new instance of this class to work with.
Anyway, see (1). There has to be some other property or a variable or something like a "SetEncoding()" method.

3) I thought that the Unicode is a default setting for C#.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top