Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileInfo.OpenRead() - what type of encoding does it use?

I'm using this method to write to a MemoryStream object, which is subsequently stored a binary in SQL. It is being used to read in .HTML files from the file system on Windows.

How do I know which type of encoding this data is being read in as? Thanks.

like image 808
Ryan Peters Avatar asked Sep 01 '25 22:09

Ryan Peters


1 Answers

None, because it opens a binary stream. When you e.g. wrap stream into a StreamReader, that's the moment you choose the encoding. The FileStream itself as returned by the OpenRead method is not text based and thus does not have an encoding.

like image 88
Pieter van Ginkel Avatar answered Sep 03 '25 12:09

Pieter van Ginkel