gdb says one has
query = "roomId=avat&count=5&offset=12&sort={\"foo\":-1}",
and the other one has
query = "roomId=avat&count=5&offset=12&sort=%7B%22foo%22:-1%7D",
Using decoded characters like '{' in the literal URL doesn't help, they
get encoded anyway. I guess one would have to use fromEncoded or special
flags to prevent that from happening. Oh well, the string representation
is what we really care about in the end (I suppose).