Jump to content

Template talk:GeoGroup

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Para (talk | contribs) at 23:15, 10 September 2013 (→‎Apostrophe URLEncode: the Commons template is broken). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconGeographical coordinates
WikiProject iconGeoGroup is of interest to WikiProject Geographical coordinates, which encourages the use of geographical coordinates in Wikipedia. If you would like to participate, please visit the project page, where you can join the project and see a list of open tasks.
Microformats
GeoGroup is part of, or of interest to, WikiProject Microformats, which encourages the deployment of microformats in Wikipedia, and documents them in the article space. If you would like to participate, visit the project page.

Bizarre URL generated from category

I have been adding this template to several categories, all of which have worked fantastically well. However, after adding it to category:Aquaria in Oregon, the Google Maps link is https://maps.google.com/maps?q=http://toolserver.org/~para/cgi-bin/kmlexport%3Farticle%3DCategory:Aquaria_in_Oregon%26l%3D0%26usecache%3D1++adding:+fbeb8caf27bfeedc3302f0880c1a270e.kml+%28deflated+72%25%29 Google Maps shows North America and gives a "we don't understand URL". Neither do I. What could have caused this?

When I used the browser "back" and clicked again, it worked fine. —EncMstr (talk) 20:40, 29 August 2013 (UTC)[reply]

Apostrophe URLEncode

The toolserver kmlexport code encodes the apostrophe as %2526%252339%253B instead of %27, generating malformed URLs. Considering for example the category

https://commons.wikimedia.org/wiki/Category:Gates_of_L%27Aquila

kmlexport generates the following URL (that doesn't work)

https://maps.google.com/maps?q=http://toolserver.org/~para/cgi-bin/kmlexport%3Farticle%3DCategory%253AGates%2Bof%2BL%2526%252339%253BAquila%26project%3DCommons

instead of

https://maps.google.com/maps?q=http://toolserver.org/~para/cgi-bin/kmlexport%3Farticle%3DCategory%253AGates%2Bof%2BL%27Aquila%26project%3DCommons

Pietro (talk) 01:45, 9 September 2013 (UTC)[reply]

There's a difference in what this template and commons:Template:GeoGroupTemplate do before passing anything on to the toolserver, and it's the Commons template at fault in this urlencoding nightmare. This template uses the FULLPAGENAMEE keyword, whereas Commons uses FULLPAGENAME. URLs break when they contain HTML encoded characters:
{{urlencode:{{urlencode:{{FULLPAGENAME}}}}}} → {{urlencode:{{urlencode:Category:Gates of L'Aquila}}}} → {{urlencode:Category%3AGates+of+L%26%2339%3BAquila}} → Category%253AGates%2Bof%2BL%2526%252339%253BAquila
{{urlencode:{{urlencode:{{FULLPAGENAMEE}}}}}} → {{urlencode:{{urlencode:Category:Gates_of_L%27Aquila}}}} → {{urlencode:Category%3AGates_of_L%2527Aquila}} → Category%253AGates_of_L%252527Aquila
They're double urlencoded because the article parameter is urlencoded first, and then again when the q parameter is urlencoded, since both can contain ampersands. --Para (talk) 23:15, 10 September 2013 (UTC)[reply]