It looked like a bug, so fixed in svn. Thanks.
The expected behavior I think is:
- Encoding property returns the "actual" encoding since it
is concrete System.Text.Encoding instance, and
- "encoding" value which could be acquired by
GetAttribute("encoding") at XML declaration state is
the "nominal" enccoding since it just returns string.
I'll add those differences on the documentation later (BTW I haven't
touched the docs or I lost my memory of doing it when you blinked).
Atsushi Eno
mirek novak wrote:
Hello,
I have installed and compiled latest mono (1.1.10) on my testing
machine to check whether Encoding property works or not. But
unfortunately it doesnt work the way I expect.
I'm including small standalone example for reproducing this error.
Can someone take a look at it to tell me where is (my) mistake?
thanks.
configuration follows
[EMAIL PROTECTED] ~]# mcs --version
Mono C# compiler version 1.1.10.0
[EMAIL PROTECTED] ~]# mono --version
Mono JIT compiler version 1.1.10, (C) 2002-2005 Novell, Inc and
Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC)
SIGSEGV : altstack
its compiled from latest sources
/// code follows ....
using System;using System.Collections;using System.IO;
using System.Text;using System.Xml;using c = System.Console;
namespace downloader {
public class showError {
public static string Code = "<?xml version=\"1.0\"
encoding=\"iso-8859-1\"?>\n<root>\n<node>\nvalue\n</node>\n</root>";
static void Main(string[] args) {
c.WriteLine(Code);
StringReader strReader = new StringReader(Code);
XmlTextReader xml = new XmlTextReader(strReader);
while (xml.Read()) {
if (xml.ReadState == ReadState.Interactive) {
System.Console.WriteLine("{0} XML No error ... {1}",
DateTime.Now, xml);
System.Console.WriteLine("{0} XML No error even
xml.Encoding is null!(maybe feature) {1}", DateTime.Now,
xml.Encoding);
System.Console.WriteLine("{0} XML Error!!!",
DateTime.Now, xml.Encoding.ToString());
}
}
}
}
}
/// --- code ends ---
regards
--
Mirek
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list