Detect the encoding of a stream

  • Thread starter Thread starter Roshan
  • Start date Start date
R

Roshan

Hi,

Is there a way in which I can detect the encoding used while creating a
StreamReader? I have a method which receives a StreamReader as a
parameter. I want to ensure that when I do a
StreamReader.BaseStream.Seek() , I give the appropriate offset so that
encoding information/byte order marks are not read in (In case the file
uses UTF8 or Unicode encoding). Is there a standard way to do that?

Thanks,
Roshan
 
Back
Top