=htc Fix handling of non-BMP characters in URI encoding/decoding

Closes #16014 by porting (improved versions) of these spray PRs:

- https://github.com/spray/spray/pull/855
- https://github.com/spray/spray/pull/856
shouldn't it be >>> or it does not matter?