Ooooooh, this is going to get messy.
In theory, URLs can only contain 7-bit ASCII characters. In practice, everyone’s pretty much decided that percent-encoded UTF-8 is , which is why, if you look in the “env” for the log message, you’ll see something like
(Which is the UTF-8 encoding for “земля”)
So, the problem is occuring because the contents of
params is being encoded as
ASCII-8BIT, and while most everything manages to figure out what’s going on and roll with it, the JSON encoding of the result, containing as it does an ASCII-8BIT string whose individual bytes don’t translate into valid UTF-8 codepoints, explodes.
Luckily, the fix is relatively straightforward: