Rework uri_encode/uri_decode to more cleanly work with bytes/strings.