Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy converts '&' in query parameters (&aen=true => &aen=true) in relative paths #710

Closed
JESii opened this issue Apr 3, 2018 · 5 comments

Comments

@JESii
Copy link

JESii commented Apr 3, 2018

Input HTML

<a class="m-j-cm-link" href="/shop/womens-clothing?id=118&edge=hybrid&aen=true&cm_sp=mew_us_homepage-_-slot1-_-Women">

Output tidied HTML

"/shop/womens-clothing?id=118&amp;edge=hybrid&amp;aen=true&amp;cm_sp=mew_us_homepage-_-slot1-_-Women">

I couldn't see an option to turn off this behavior...

@geoffmcl
Copy link
Contributor

geoffmcl commented Apr 4, 2018

@JESii I do not think there is a tidy option to turn this off...

We do have an option --fix-uri no, but this only effects the escaping of illegal characters, and does not effect an ampersand...

But why would you want it turned off?

If you view the link as tidy has escaped it, in a browser, it should appear without the &amp;, just with the &, so the link will function correctly...

Maybe I misunderstand the case... need further feedback... thanks...

@geoffmcl geoffmcl added this to the 5.7 milestone Apr 4, 2018
@mc0e
Copy link

mc0e commented Apr 7, 2018

Tidy's behavior here is turning incorrect html into correct html. I'd have to say though that I've never liked the readability of those &amp; character entities, and I much prefer the use of ;, which is blessed by the CGI spec as an alternative to the ampersand in query strings.

@JESii
Copy link
Author

JESii commented Apr 8, 2018

Well... I've never seen it converted to &amp; in the href attribute; in fact the wikipedia entry on query strings indicates that either '&' or ';' (as mentioned by @mc0e above) is allowed. I'm not worried about viewing the ampersand; I want it to just be the delimiter for and the next key/value pair. it may view better, but from a programming perspective, it makes it harder to see what's going on -- the ';' is easy to miss (I've made that mistake before :=)

@mc0e
Copy link

mc0e commented Apr 8, 2018

& is correct in the query string, but to represent an & in html, you write it as a character entity. With html, an unescaped & is usually not the start of something that looks like a defined character entity, and browsers deal with that. In XHTML though it violates the requirement of being well formed XML, and the browser is required to reject it.

@JESii
Copy link
Author

JESii commented Apr 8, 2018

OK... got it. thanks!

@JESii JESii closed this as completed Apr 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants