Page MenuHomePhabricator

Unable to get pageviews for the title with ' in the name
Closed, ResolvedPublic


@Krassotkin reported this page fails to show any graphs.

Men's Health is for some reason gets url path encoded as Men%26%2339%3Bs%20Health -- in other words the title of the page is HTML encoded (' => ') before url encoding.

(full url)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Milimetric moved this task from Incoming to Analytics Query Service on the Analytics board.

I'm not sure if this is analytics it wiki escaping issue. The HTML escaping
happens before URL encoding

{{Graph:PageViews|100|Men's Health}} on en wiki works fine, encoding the value as
or another words -- Men%27s%20Health

{{Graph:PageViews}} on the Men's Health article tries to get the data from
which is incorrect: Men%26%2339%3Bs%20Health

The problem is in the template itself - {{urlencode:{{{2|{{ARTICLEPAGENAME}} }}}|PATH}} produces Men%26%2339%3Bs%20Health. Suggestions?

This problem can easily be solved with Lua, or decoding html entries, e.g. {{#htmldecode | {{ARTICLEPAGENAME}} }} (doesn't exist). The {{ARTICLEPAGENAMEE}} is not good because it uses URL query encoding, not URL path encoding (first does not encode the '/' symbol). The problem is that having Lua reduces portability of the template - lua code has to be kept in sync as well.

Sorry, no suggestions from me, I think the pageview API is doing the right thing, just blindly decoding.

Change 289131 had a related patch set uploaded (by Yurik):
Add {{urlencode:...|REPATH}} magic keyword

Change 289131 abandoned by Yurik:
Add {{urlencode:...|REPATH}} magic keyword

Yurik claimed this task.