diff --git a/src/service/location.js b/src/service/location.js index 1accb9931fc4..b02704324d57 100644 --- a/src/service/location.js +++ b/src/service/location.js @@ -335,7 +335,7 @@ LocationUrl.prototype = { if (paramValue === null) { delete this.$$search[search]; } else { - this.$$search[search] = encodeUriQuery(paramValue); + this.$$search[search] = paramValue; } } else { this.$$search = isString(search) ? parseKeyValue(search) : search; diff --git a/test/service/locationSpec.js b/test/service/locationSpec.js index 646a9ca04951..049f49d7e3cb 100644 --- a/test/service/locationSpec.js +++ b/test/service/locationSpec.js @@ -330,6 +330,17 @@ describe('$location', function() { expect(url.search()).toEqual({'i j': '<>#'}); expect(url.hash()).toBe('x <>#'); }); + + it('should return decoded characters for search specified in URL', function() { + var locationUrl = new LocationUrl('http://host.com/?q=1%2F2%203'); + expect(locationUrl.search()).toEqual({'q': '1/2 3'}); + }); + + it('should return decoded characters for search specified with setter', function() { + var locationUrl = new LocationUrl('http://host.com/'); + locationUrl.search('q', '1/2 3'); + expect(locationUrl.search()).toEqual({'q': '1/2 3'}); + }); }); });