I have file in cp866 encoding. In some places it's file contains symbol 0 in hex code. When I try to read this file with File.ReadAllText() or streamReader.Read() it's stop reading file in this symbol. How to solve this problem?
[UPDATE]
I think that symbol 0x0 means end of file.
Are you looking for something like this?
Encoding encoding = Encoding.GetEncoding(866);
string text = File.ReadAllText("foo.txt", encoding);
That assuming you want code page 866.
I don't know enough about CP866 to know whether it would normally contain 0 bytes... but if your text file is valid CP866, the above should read it.
Hmmm. I think you should read file as binary file not as text file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With