Fixed UTF-8 encoding in URLs in URL plugin.

Only by encoding the incoming URL part to octets does URL encoding work
correctly. Without this, valid UTF-8 in query parameters, for example, turns
into nonsense when encoded and will be invalid when decoded.

This supersedes the previous PR, which I've closed.