dealing with path segments. The previous use of urlencode/decode
would erroneously transform + characters into spaces.
Also updated tests with new checks to verify all characters which
don't absolutely require encoding pass through unchanged and that
encoding works correctly for all characters (even if they do not
strictly speaking require it).