|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Detect the encoding of a streamHi,
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 There's StreamReader.CurrentEncoding; Why didn't I see it earlier? :-(
Roshan Roshan wrote: Show quote > 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 |
|||||||||||||||||||||||