PC Review


Reply
Thread Tools Rate Thread

Detect the encoding of a stream

 
 
Roshan
Guest
Posts: n/a
 
      19th Dec 2005
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

 
Reply With Quote
 
 
 
 
Roshan
Guest
Posts: n/a
 
      19th Dec 2005
There's StreamReader.CurrentEncoding; Why didn't I see it earlier? :-(

Roshan

Roshan wrote:

> 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


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect the encoding of a stream Roshan Microsoft Dot NET 1 19th Dec 2005 10:43 AM
Stream.Write / Encoding problem Ireney Berezniak Microsoft Dot NET Framework 1 25th Nov 2004 02:48 AM
Stream.Write / encoding problem? Ireney Berezniak Microsoft ASP .NET 0 24th Nov 2004 06:21 PM
Using Stream objects with encoding Gaia C via .NET 247 Microsoft C# .NET 3 6th Sep 2004 11:21 AM
How can i get one stream Encoding Name? Help me? qushui_chen Microsoft C# .NET 0 21st Oct 2003 03:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:41 AM.