Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5075 closed defect (invalid)

Embed-code contains wrong letters

Reported by: db@… Owned by: rails-dev@…
Priority: minor Milestone:
Component: website Version:
Keywords: Cc:

Description

Hi!

I want to embed a map with OpenStreetMap on my website. On building with the embed-function, the map is totally zoomed out. With the forum I found out, that there is a & instead of the "&" in the code.

You see it best here: http://www.davidb.at/karte.png

Change History (6)

comment:1 Changed 6 years ago by pnorman

Resolution: invalid
Status: newclosed

It is correct to encode the & in URLs as &

comment:2 in reply to:  1 ; Changed 6 years ago by colin.smale@…

Replying to pnorman:

It is correct to encode the & in URLs as &

I am not so sure that that is always true ...

It will depend on whether XHTML or legacy HTML is being used, and apparently sometimes on the browser as well according to this article from 2008: http://stackoverflow.com/questions/275150/xhtml-and-ampersand-encoding

comment:3 in reply to:  2 ; Changed 6 years ago by Jonathan Bennett

Replying to colin.smale@…:

I am not so sure that that is always true ...

Yes, it is, and the very article you reference points this out and explains the most common mistake of pasting an HTML encoded link directly into a browser's address bar:

"The encoding of & as & is required in HTML, not in the link. When the browser sees the & in the HTML source for a link it will interpret it as an ampersand and the link target will be as intended. If you paste a URL into your browser address bar it does not expect it to be HTML and does not try to interpret any HTML encoding that it may contain. This is why your example links that you suggest we should copy/paste into a browser don't work and why we wouldn't expect them to work."

comment:4 Changed 6 years ago by Tom Hughes

Just to add to which, when you select "Link" in the share tab we do not encode the ampersand, but when you select "HTML" to get an HTML fragment we do encode it. All of which sounds correct to me.

comment:5 Changed 6 years ago by aseerel4c26

this is a duplicate of ticket #4949

comment:6 in reply to:  3 Changed 6 years ago by colin.smale@…

Replying to Jonathan Bennett:

Replying to colin.smale@…:

I am not so sure that that is always true ...

Yes, it is, and the very article you reference points this out and explains the most common mistake of pasting an HTML encoded link directly into a browser's address bar:

"The encoding of & as & is required in HTML, not in the link. When the browser sees the & in the HTML source for a link it will interpret it as an ampersand and the link target will be as intended. If you paste a URL into your browser address bar it does not expect it to be HTML and does not try to interpret any HTML encoding that it may contain. This is why your example links that you suggest we should copy/paste into a browser don't work and why we wouldn't expect them to work."

I stand entirely corrected. Having read the standards again it seems that accepting a bare "&" was strictly a non-compliance and everybody should have been using "&" in the first place.

Note: See TracTickets for help on using tickets.