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

Should tyxml percent-encode urls ? #264

Open
Julow opened this issue Apr 1, 2020 · 2 comments
Open

Should tyxml percent-encode urls ? #264

Julow opened this issue Apr 1, 2020 · 2 comments

Comments

@Julow
Copy link
Contributor

Julow commented Apr 1, 2020

Code like this:

p [ a ~a:[ a_href "#val-(^)" ] [ txt "val (<)" ] ];
p [ a ~a:[ a_href "#val-(<)" ] [ txt "val (<)" ] ];
p [ a ~a:[ a_href "#val-(>)" ] [ txt "val (<)" ] ];

Generates HTML like this:

<p><a href="#val-(^)">val (&lt;)</a></p>
<p><a href="#val-(&lt;)">val (&lt;)</a></p>
<p><a href="#val-(&gt;)">val (&lt;)</a></p>

Of course, web browsers accept this but tidy-html5 generates warnings:

Warning: <a> escaping malformed URI reference
Warning: <a> illegal characters found in URI
Warning: <a> escaping malformed URI reference
Warning: <a> illegal characters found in URI

Should Tyxml percent-encode the value of href attributes ?

@Drup
Copy link
Member

Drup commented Apr 10, 2020

Excellent question, I'm slightly surprised it does that. Do you know what the specs says ?

@Julow
Copy link
Contributor Author

Julow commented Apr 10, 2020

It seems that () and ^ are wrong in the url: https://url.spec.whatwg.org/#absolute-url-with-fragment-string
It also seems that HTML is directly linking to the URL spec (here) but seems to allow "Named character reference" everywhere (I couldn't find this explicitly but there doesn't seem to be any exception).
I found a HTML4 reference that allows them explicitly.

jonludlam added a commit to jonludlam/odoc that referenced this issue Apr 20, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
jonludlam added a commit to jonludlam/odoc that referenced this issue Apr 20, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
jonludlam added a commit to jonludlam/odoc that referenced this issue Apr 30, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
jonludlam added a commit to jonludlam/odoc that referenced this issue Jun 2, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
jonludlam added a commit to jonludlam/odoc that referenced this issue Jul 2, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
jonludlam added a commit to ocaml/odoc that referenced this issue Jul 3, 2020
These cause html5-tidy to fail, and it's not yet clear where to fix
the issue. They're not particularly important for testing Odoc's
core functionality so I'm disabling them for now.

See ocsigen/tyxml#264 for more info

Signed-off-by: Jon Ludlam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants