Properly encode URI paths, closes #222

#222

//cc @jmeas