Search code examples
c#xmlwindows-phone-7character-encodingbig5

Reading BIG5 encoded data using XmlReader on Windows Phone


I am trying to get a XML content from here link. Then get the content of "item" element to display on screen. It's kind of RSS Reader on WP7. The issue were when I examine the content, the bytes seems have been modified (translated) with different encoding way, which should be using BIG5 but it is not. However, the native browser does show those BIG5 encoded characters though. Don't know how they get it.

I tried this

using (XmlReader reader = XmlReader.Create(URL) //URL to a XML file on Internet
while (reader.Read())  // iterate through the document
    switch (reader.NodeType)  
        case XmlNodeType.Text:  
            string s = reader.Value; // The string displayed as garbage

And I tried to use the EncodingGenerator as suggested by Jesse, but that didn't work as it doesn't support multibyte encodings.


Solution

  • I think that the non-support of the BIG5 encoding is an issue of Windows Phone in general, not of XmlReader. So you'll end up with the same issue if you switch to the HtmlAgilityPack.

    Check out https://stackoverflow.com/a/10277767/736079 for a possible solution.