Properly decode URI components before use them.

see #481
Merge branch '1.0.x'