Valid urls

Anything about use of this forum : NOT about cycling
Abradable Chin
Posts: 330
Joined: 7 Aug 2016, 7:38pm
Location: Peripatetic

Valid urls

Postby Abradable Chin » 4 Dec 2016, 12:58pm

[url=https://en.wikipedia.org/wiki/Nickel–iron_battery]Why isn't this URL allowed[/url]?It seems to have an en-dash in it (ascii 150D)

User avatar
gaz
Posts: 14162
Joined: 9 Mar 2007, 12:09pm
Location: Kent, lorry park of England

Re: Valid urls

Postby gaz » 4 Dec 2016, 3:39pm

Abradable Chin wrote:[url=https://en.wikipedia.org/wiki/Nickel–iron_battery]Why isn't this URL allowed[/url]?It seems to have an en-dash in it (ascii 150D)

AIUI the forum software is an open source package which apart from adding the branding has minimal alteration from the out of the box package. Helps keep costs down within the shoestring budget Cycling UK allocate to running the forum.
Work around.
There'll be tarmac over, the white cliffs of Dover ...

drossall
Posts: 5126
Joined: 5 Jan 2007, 10:01pm
Location: North Hertfordshire

Re: Valid urls

Postby drossall » 4 Dec 2016, 4:25pm

This works.

You're right; its the n-rule that's not valid in an URL (here or anywhere else). You need to use the dash (ASCII-45). Not sure how you got an n-rule into that URL?

Abradable Chin
Posts: 330
Joined: 7 Aug 2016, 7:38pm
Location: Peripatetic

Re: Valid urls

Postby Abradable Chin » 4 Dec 2016, 7:17pm

It's the official URL. The minus-sign one redirects to the en-dash one, fortunately.

drossall
Posts: 5126
Joined: 5 Jan 2007, 10:01pm
Location: North Hertfordshire

Re: Valid urls

Postby drossall » 4 Dec 2016, 8:44pm

If it's got an illegal character, then it's not an URL. Try encoding the offending character:
https://en.wikipedia.org/wiki/Nickel%96iron_battery

What I think is happening is that Wikipedia links are built from the names of its articles. Those can contain special characters. URLs can't. So, Wikipedia transliterates. If you're quoting the page outside Wikipedia, you need the transliterated URL (with a normal dash) or the encoded one, as above.

More details on Wikipedia page names and URLs.