Build and parse URLs with properly encoded parameters.
Fills the base URL, parameters and hash below.
Duplicate keys are kept in order (e.g. tag=a&tag=b). Keys and values are percent-encoded with encodeURIComponent.