Re: Uri class - encoding problem

Hi Petr,

Problem is that a query gets encoded after it’s already in one piece (concatenated). As a solution I’d suggest to implement query storage and encoding differently (piecewise). Instead of keeping a whole query in one QByteArray, store it in a QList and when it has to be encoded, take a first parameter, encode it, append it (after appending a delimiter), take a value, encode it and if it’s not empty, append ‘=’ and the encoded value.

I didn’t think of that… Initially I thought about keeping a QList but the problem is that in general the query component is not required by the URI specs to have any specific format. Using & and = is an URL practice. I’d suggest that appendQueryItem() escapes the bytes before concatenating them… but then query should not be encoded once again when producing the complete URI…

I’ll fix that later tonight (will branch from your latest rev)!

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Uri class - encoding problem
Hi Peter, I found a bug in the Uri class (URL encoding) when I was updating the TrackerRequestWriter to use Uri class for URL creation. If I create a URL and (more...)

No follow-ups yet.