Fixing an Apostrophe URL Bug

  • Thread starter A.T.
  • Start date
  • #1
A.T.
Science Advisor
12,276
3,470
Posting an URL with an apostrophe, like:

http://en.wikipedia.org/wiki/Euler's_identity

creates a broken link, because the apostrophe is not properly escaped in the internally generated URL:

http://api.viglink.com/api/click?format=go&key=6afc78eea2339e9c047ab6748b0d37e7&loc=http%3A%2F%2Fwww.physicsforums.com%2Fshowthread.php%3Ft%3D690460&v=1&libId=812d4dfe-4823-41b6-96f6-4bf0b020e903&out=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuler[B][COLOR="red"]'[/COLOR][/B]s_identity&ref=http%3A%2F%2Fwww.physicsforums.com%2Fforumdisplay.php%3Ff%3D111&title=Beautiful%20Equations&txt=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuler's_identity&jsonp=vglnk_jsonp_13680463957848[/QUOTE]

Correct URL should be:

http://api.viglink.com/api/click?format=go&key=6afc78eea2339e9c047ab6748b0d37e7&loc=http%3A%2F%2Fwww.physicsforums.com%2Fshowthread.php%3Ft%3D690460&v=1&libId=812d4dfe-4823-41b6-96f6-4bf0b020e903&out=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuler[B][COLOR="Red"]%27[/COLOR][/B]s_identity&ref=http%3A%2F%2Fwww.physicsforums.com%2Fforumdisplay.php%3Ff%3D111&title=Beautiful%20Equations&txt=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuler's_identity&jsonp=vglnk_jsonp_13680461919027[/QUOTE]
 
Last edited by a moderator:
Physics news on Phys.org
  • #3
But the link works. :confused:

Edit: By the way, a similar thing happens when you search the forum for "Poincaré" for example. The search results will be links like this: https://www.physicsforums.com/showthread.php?t=689398&highlight=poincar%E9
Code:
https://www.physicsforums.com/showthread.php?t=689398&highlight=poincar%E9
If you click it, you will get a 406 Not Acceptable. So what I always do is to right-click, open link in new tab, and then delete the & and everything to the right of it from the URL.

Edit 2: I'm using Firefox.
 
Last edited:
  • #5
Works on Firefox
Bugs on Chorme

Other special characters might be affected too.
 
  • #6
Viglink support says

The character encoding is handled by your browser's URL bar, it is not unique to the VigLink API. Some browsers will automatically escape/encode all characters in URLs, others will only do some and not others.
 
  • #7
It looks like a Chrome bug:

1) Click the link -> white page
2) Open in new tab -> page displays OK
 
  • #8
I am wondering why that detour via viglink.com is used at all. And why it appears to be present for Chrome only.Edit: Why does Chrome need an additional website to track clicks? I think the browser does that anyway? :D
 
Last edited:
  • #9
mfb said:
I am wondering why that detour via viglink.com is used at all. And why it appears to be present for Chrome only.

Click tracking
 
  • #10
mfb said:
I am wondering why that detour via viglink.com is used at all.
Big Brother

mfb said:
And why it appears to be present for Chrome only.
Because Google product users don't mind being spied on. But it's still annoying if those detours break something. Now at least I know a workaround.
 
  • #11
mfb said:
I am wondering why that detour via viglink.com is used at all. And why it appears to be present for Chrome only.Edit: Why does Chrome need an additional website to track clicks? I think the browser does that anyway? :D

Why do you think vigilink usage only occurs for chrome? I see it referenced when PF is used by firefox (and I use software that shows what url's are accessed during navigation).
 
Last edited:
  • #12
PAllen said:
I see it referenced when PF is used by firefox (and I use software that shows what url's are accessed during navigation).
Same here and I have no problem with it as I want PF to grow and prosper.
 
  • #13
PAllen said:
Why do you think vigilink usage only occurs for chrome? I see it referenced when PF is used by firefox (and I use software that shows what url's are accessed during navigation).
This is what the forum sends to my firefox:

Code:
<div id="post_message_4376188">

Posting an URL with an apostrophe, like:<br />
<br />
<a href="[PLAIN]http://en.wikipedia.org/wiki/Euler&#[b][/b]39;s_identity"[/PLAIN]  target="_blank">[PLAIN]http://en.wikipedia.org/wiki/Euler's_identity</a><br[/PLAIN]  />
<br />
[...]
It is the converted BB-Code, and nothing else. It is up to the browser to interpret &#39;, and firefox can do that.
 
Last edited by a moderator:
  • #14
mfb said:
This is what the forum sends to my firefox:

Code:
<div id="post_message_4376188">

Posting an URL with an apostrophe, like:<br />
<br />
<a href="[PLAIN]http://en.wikipedia.org/wiki/Euler&#[b][/b]39;s_identity"[/PLAIN]  target="_blank">[PLAIN]http://en.wikipedia.org/wiki/Euler's_identity</a><br[/PLAIN]  />
<br />
[...]
It is the converted BB-Code, and nothing else. It is up to the browser to interpret &#39;, and firefox can do that.

I wasn't talking about what happens with this url, but the general use of viglink by PF, which I assume is benign (and good for PF). Code like the following gets executed during navigation around PF:

var vglnk = { api_url: '//api.viglink.com/api',
key: '6afc78eea2339e9c047ab6748b0d37e7' };

(function(d, t) {
var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;
s.src = ('https:' == document.location.protocol ? vglnk.api_url :
'//cdn.viglink.com/api') + '/vglnk.js';
var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);
}(document, 'script'));
 
Last edited by a moderator:

1. What is an apostrophe URL bug?

An apostrophe URL bug is a common issue that occurs when a website or application does not properly handle apostrophes in URLs. This can lead to broken links or other errors when trying to access a specific webpage.

2. How does an apostrophe URL bug affect a website?

An apostrophe URL bug can prevent users from being able to access certain pages on a website, as the apostrophe in the URL may be interpreted as a special character and cause the link to break. This can result in a poor user experience and decreased functionality of the website.

3. What causes an apostrophe URL bug?

An apostrophe URL bug can be caused by a variety of factors, such as incorrect coding or programming, outdated software, or user input errors. It can also be caused by different browsers or devices interpreting apostrophes in URLs differently.

4. How can an apostrophe URL bug be fixed?

The most effective way to fix an apostrophe URL bug is to ensure that all code and programming related to URLs is properly written and updated. This includes escaping special characters like apostrophes, as well as testing the website on different browsers and devices to ensure compatibility.

5. How can I prevent an apostrophe URL bug from occurring?

To prevent an apostrophe URL bug, it is important to follow best practices when coding and programming, such as properly escaping special characters and regularly updating software. It is also helpful to test the website on different browsers and devices before launching to ensure compatibility.

Similar threads

  • Feedback and Announcements
Replies
3
Views
2K
Replies
4
Views
3K
  • High Energy, Nuclear, Particle Physics
Replies
12
Views
2K
  • Biology and Medical
Replies
5
Views
2K
Replies
4
Views
292
  • Astronomy and Astrophysics
Replies
8
Views
2K
  • Science Fiction and Fantasy Media
Replies
8
Views
2K
  • Special and General Relativity
Replies
6
Views
2K
Back
Top