So, I decided to make the query manually, giving it as Base64-encoded SQL query to check what’s wrong.
It returned a nice set of XML – with one exception: the browser said there’s a 0x0 character on row 15. That would explain a lot, so I checked row 15. Just normal written text as UTF-8 string in the database. I copied the text and pasted it to Skype for the person who wrote it, with a note after the text.
The note disappeared. Found the null character.
After a quick search I learned that it is actually possible to write a NULL character from the keyboard. Didn’t know that. This brings up a whole bunch of new problems that everyone should keep in mind when writing software. Especially when dealing with HTTP servers, as they, sometimes when it’s possible, also send the size of the page in the headers, and the client side then downloads everything but doesn’t expect a NULL character, and sometimes, when no size is sent, client may stop at a NULL. Both times you’ll probably end up mishandling the data.