The precent encoding is done on characters, not on bytes.
That's not correct. On UTF-8 locales, each byte is encoded separately.
I presume you are trying this on an amd64 machine, which has a signed char, so the valid range is from -128 (or -127) to 127 only. I am a bit at a lost here as I don't understand what the problem is… maybe you can give us an idea how and why you are trying to sent bytes instead of characters in our textinterface here?
Well, I was just diagnosing a problem with APT downloads and enabled debug output, and in that output there were error messages (from strerror(3)) which were encoded such that each character was encoded into 18 characters, which is not very easy to read, like this: %ffffffd0%ffffff9e%ffffffd1%ffffff82%ffffffd0%ffffffba%ffffffd0%ffffffb0%ffffffd0%ffffffb7%ffffffd0%ffffffb0%ffffffd0%ffffffbd%ffffffd0%ffffffbe %ffffffd0%ffffffb2 %ffffffd0%ffffffb4%ffffffd0%ffffffbe%ffffffd1%ffffff81%ffffffd1%ffffff82%ffffffd1%ffffff83%ffffffd0%ffffffbf%ffffffd0%ffffffb5 And I thought that it would be a good idea if they were encoded in some more human-readable way, because I think that I shouldn't need a script just to decode debug output.