Work around obsolescence of URI.encode

We do this by using the underlying parser directly, bypassing the
warning, but more importantly depending on still-supported
functionality.

Also fixes a few other warnings that have cropped up.