Compatibility with ISO 8859-1 or another encoding

Jan 27, 2011 at 11:57 PM

Hi,

I've remarked, that QDFeedParser is not compatible with ISO 8859-1. Exemple : the letter "à" is changed to "".

To solve this problem,, I've changed the function "DownloadXml" into HttpFeedFactory :

var request = WebRequest.Create(feeduri) as HttpWebRequest;
request.KeepAlive = false;
string responseXml;

// Temporary correction (for another encoding)
var client = new WebClient();
responseXml = client.DownloadString(feeduri);

//using (var response = request.GetResponse() as HttpWebResponse)
//{
//    responseXml = GetResponseXml(response);
 //}

return responseXml;

This is not the good solution (but very very fast), I think that the good solution is here :

var reader = new StreamReader(response.GetResponseStream(),/* Define the encoding here !! */);
var responseXml = reader.ReadToEnd();
return responseXml;

I thank you, for reading this comment.

And sorry for my English :(

Flo

 

Coordinator
Jan 28, 2011 at 12:24 AM

Flo,

Thanks for reporting this - I think by default QD Feed Parser assumes UTF8 encoding, but as you point out, this doesn't cover all cases!

If you'd like to write a patch, we should add an overload to the IFeedFactory interface to support an encoding as an optional parameter for each CreateFeed and DownloadString call (since all overloads of CreateFeed save one call DownloadString) and then do as you suggested.

Would you like to contribute this or should I do it? I'd like to encourage community contributions to the fullest extent possible :p

Coordinator
Jan 28, 2011 at 12:25 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.