Encoding of Generated Patches and Pastebin Plugin

David Narvaez david.narvaez at computer.org
Wed Dec 21 22:07:20 UTC 2011


On Mon, Dec 19, 2011 at 3:43 AM, Andreas Pakulat <apaku at gmx.de> wrote:
> However since we can assume this is 'binary data', its not necessary to
> read the file at all. Simply write a conversion-function which works on
> the binary data. That is, assume plain-ascii for the content and encode
> based on that. Reading parts of
> http://en.wikipedia.org/wiki/Percent-encoding I'd assume thats what the
> browser does when you upload a file to pastebin directly.

Pastebin's API requires the POST data to be sent in UTF-8, so we'd
still need to convert from whatever we detect/the user specifies to
UTF-8. I understand your idea, but there's one detail that wasn't
working for me. I can't remember right now what was it, but I think it
stems from the fact that you read a QByteArray from the file but
QUrl::toPercentEncoding expects a QString, so an implicit conversion
happens under QString rules (which, I think, interpreted the
QByteArray as a Latin-1 string in my case) or something of that sort.

David E. Narvaez




More information about the KDevelop-devel mailing list