Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($location): parse query parameters delimited by ; or & #6167

Closed
wants to merge 1 commit into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Feb 7, 2014

In accordance with recomendation in http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2, the query parameters should support encoding and decoding using & or ; as a delimiter.

Angular will consistently encode search queries using either '&' or ';' as the delimiter, with '&' being the default. This can be configured like so:

$locationProvider.queryDelimiter(';'); // any other value will be treated as '&'

Closes #6140

In accordance with recomendation in http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2, the
query parameters should support encoding and decoding using & or ; as a delimiter.

Angular will consistently encode search queries using either '&' or ';' as the delimiter, with '&' being the default.
This can be configured like so:

```js
$locationProvider.queryDelimiter(';'); // any other value will be treated as '&'
```

Closes angular#6140
@caitp caitp added this to the 1.3.x milestone Feb 7, 2014
khepin pushed a commit to khepin/angular.js that referenced this pull request Feb 19, 2014
@khepin
Copy link

khepin commented Feb 20, 2014

See: #6341 as this is currently not following the RFC. It should be either ; or &, but not both at the same time.

@caitp
Copy link
Contributor Author

caitp commented Feb 22, 2014

@khepin to be honest I couldn't find any mention of this in an RFC, just a vague recommendation from the W3C. I'd like to also do this without adding a visible property to $location, if I can possibly do that. We'll see.

@khepin
Copy link

khepin commented Feb 22, 2014

Well yeah, this:

We recommend that HTTP server implementors, and in particular, CGI implementors support 
the use of ";" in place of "&" to save authors the trouble of escaping "&" 
characters in this manner.

is the only place that mentions the use of ; at all and is only a recommendation but doesn't in place of imply that it should be one or the other? (honestly asking) That's how I understood it.

Otherwise, I understand that you want to keep this property out of the $location. Would be better.

@caitp
Copy link
Contributor Author

caitp commented Feb 22, 2014

I think it makes sense to use one or the other, and it makes a lot of sense on the server. But the trouble with us is we're on the client-side, and we're talking to possibly multiple websites, some of which may require ; for some reason, and others not knowing what to do with that. It's a bit tricky.

@caitp caitp closed this Oct 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: $location.seach() should support semicolon (;) as an alternative delimiter to (ampersand) &
5 participants