dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]how to find ByteOrder Marks


From: Rhys Weatherley
Subject: Re: [DotGNU]how to find ByteOrder Marks
Date: Thu, 6 Mar 2003 08:06:44 +1000
User-agent: KMail/1.4.3

On Wednesday 05 March 2003 09:16 pm, minddog wrote:
> I don't know how to find these marks from a streamFragment since I am
> unsure if there is a class that already does this.  Anyone help me out
> here? =)

As Gopal pointed out, StreamReader is the way to go.  Even for URI's - 
System.Net returns a Stream for the body of the request, which can then be 
wrapped in a StreamReader to do encoding detection.  Currently, UCS-4 isn't 
supported in StreamReader, but we should add it there rather than in the XML 
layer.  If someone could log a bug ("UCS-4 encodings missing"), I'll take 
care of it.

On Thursday 06 March 2003 01:48 am, address@hidden wrote:

> Some XmlTextReader constructor and XmlDocument.Load supplies only
> url and in such case we must implement encoding detection
> by ourselves.
> StreamReader (of MS.NET) cannot detect actual encoding of the
> target stream, at least my Shift_JIS environment.

I believe that non-Unicode encodings, such as Shift-JIS, are passed to 
XmlTextReader explicitly as part of the XmlParserContext parameter.  MS'es 
implementation cannot auto-detect as far as I can tell.  We might be able to 
smooth this a little for url's, by using the "charset" parameter on the MIME 
type in the HTTP header to automatically create the correct encoding object.  

Cheers,

Rhys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]