[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

ASP.NET RSS Reader into HTML Format Encoding Problem

Asked by digitalpacman in Programming for ASP.NET, C# Programming Language, RSS

Tags: C#, ASP.NET, RSS, HTML, charcter encoding

Problem:
I can't seem to write the proper character encoding from an RSS feed.
I need to read the RSS feed (this works) and then format the feed into HTML and write the HTML along with the proper character encoding so the browser can display special characters properly.

For example I need to read a Shift_JIS RSS and then know it is Shift_JIS so that I can print out "Shift_JIS" to the charset header and/or the <meta> tag for content type.

I am using C#. I have code that works on one feed, but when I change the source all of a sudden the character encoding becomes NULL.
1:
2:
3:
4:
5:
6:
7:
8:
XmlTextReader textReader = new XmlTextReader(rssUrl);
XmlReader xmlReader = null;
SyndicationFeed feed = null;
 
xmlReader = XmlReader.Create(textReader, new XmlReaderSettings());
feed = SyndicationFeed.Load(xmlReader);
feedEncoding = textReader.Encoding.WebName; // This sometimes errors
context.Response.Charset = feedEncoding;
[+][-]10/20/09 10:32 PM, ID: 25620995Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 04:32 PM, ID: 25745707Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625