Page MenuHomePhabricator

Char "#" in reference name itself should be URL/HTML encoded entity
Open, LowPublicBUG REPORT

Description

What wrong
If the user use the char "#" in the reference name (minimal) as the first char, so:

In the HTML output is the <a> link with two chars "#". That is invalid (See 1, 2).

**Example of the wrong situation

The right way
the # character will remain allowed for users, but in the internal source will have the char "#" another transcription.

Event Timeline

Looking at the changes in https://ja.wikipedia.org/w/index.php?title=%EF%BC%BBAlexandros%EF%BC%BD&diff=prev&oldid=89972724 and then https://ja.wikipedia.org/w/index.php?title=%EF%BC%BBAlexandros%EF%BC%BD&oldid=89972724 (please provide direct links, step by step)

In the HTML output is the <a> link with two chars "#".

I cannot find any ## in the HTML of the page.

in the output page it doesn't work the reference tooltip.

That's the local gadget https://ja.wikipedia.org/wiki/MediaWiki:Gadget-ReferenceTooltips.js . User scripts, gadgets, templates, custom CSS are local on-wiki content. Local content is managed independently on each wiki, by each wiki community themselves. This needs fixing on the local wiki. Hence I am closing this task here - thanks for your understanding!

Aklapper renamed this task from The char "#" in the reference name to Char "#" in reference name breaks local Gadget-ReferenceTooltips.js to show a popup.Jun 27 2022, 7:46 AM
Dusan_Krehel renamed this task from Char "#" in reference name breaks local Gadget-ReferenceTooltips.js to show a popup to Char "#" in reference name.Jun 27 2022, 6:33 PM
Dusan_Krehel reopened this task as Open.

@Aklapper: I mind "with 2 chars #", but none "with double char #". Wikimedia take the reference name and then add the custom prefix with first char "#". Then in <a> tag is the output <a href="#someonthing#someonthing">. And that is none valid HTML. The right is <a href="#someonthing%23someonthing">.

Aklapper renamed this task from Char "#" in reference name to Char "#" in reference name itself should be URL/HTML encoded entity.Jun 27 2022, 8:35 PM
Aklapper added a project: MediaWiki-Parser.
Aklapper updated the task description. (Show Details)

Hi, please don't report two different things in one bug report...

Bad value #cite_note-#1-32 for attribute href on element a: Illegal character in fragment: # is not allowed.

See also T20431

In the HTML output is the <a> link with two chars "#". That is invalid.

This is incorrect, # in the fragment part of an URL is *not* supposed to be percent-encoded. It must only be encoded if it occurs in the path or the query. See https://url.spec.whatwg.org/#fragment-percent-encode-set