Use mimeType to decide if we use escape or encodeURIComponent (followup b78e4d1eb830fb95945e22e129f74b7de20cbbfb)