Search code examples
c#xmlwindows-phone-7unicodebig5

Does XMLRead.Create(new StringReader) provide capability to read non-unicode (BIG5)?


I am trying to access a webpage that has BIG5 encoding paragraph. After retrieving the xml data, I use XMLRead.Create(new StringReader(xmldata)) and get the big5 characters from reader.Value of XmlNodeType.Text type. In WP runtime, it does not support BIG5 encoding so I have to get each byte and convert to unicode for display on WP7. However, the byte I get the from reader.Value seems not what I expected. For example, the first Chinese character is B5E1. But I got FDFD. What's wrong is that?

using (XmlReader reader = XmlReader.Create(new StringReader(xmldata)))  
while (reader.Read())  
    switch (reader.NodeType)  
        case XmlNodeType.Text:
            string s = reader.Value;  
            foreach (byte input in s)  
                # the input gives unexpected result  

The webpage to load is http://feeds.feedburner.com/nownews/politic

I am using VS2010 for WP7 development work.

Any help is appreciated!


Solution

  • Windows Phone SDK doesn't support BIG5 encoding, but if you need it, just go ahead and generate the encoding class with the Silverlight Encoding Generator.