you should decodeURIComponent on pair[0] as well I think