More URI encoding and decoding. Addresses #1406