Handle single quote in oneboxes

(Sam Saffron) #1

We should handle single quotes in oneboxes

Continuing the discussion from How does the Discourse project work?:

http://en.wikipedia.org/wiki/Parkinson%27s_law_of_triviality works (what ie does)

But, http://en.wikipedia.org/wiki/Parkinson's_law (default chrome cut and paste url, does not)

cc @Lid

(lid) #2

I replied in the other thread.

39 Dec = 27 Hex

How did you get ’ to translate to the 39 value? did you copy from the address bar or copy a link?

somehow I get mine right on chrome

(Sam Saffron) #3

I copy directly from the address bar, perhaps this is a mac thing?

(lid) #4

I couldn’t replicate on windows.

Technically if the link was copied or linked from wikipedia, it seem that wikipedia encode the char correctly in their links.

I tried to search for the article in google, go to the page and copy paste the url. and the char was intact ( no special encoding) and that link is not supported by onebox

which mean that this bug report is actually about 2 issues.

  1. Possibly mac chrome , encode single quote char incorrectly.
  2. Onebox does not encode properly encode single quote when requesting the article.

For the 1st issue, if it is browser related should probably be reported to the browser vendor
for the 2nd issue, we need to adjust the match rule and convert ’ to & #27 when forming the url for request.

@sam is single quote is the only char that is encoded wrongly when copied from address bar?

(Sam Saffron) #5

I can confirm firefox on mac works as expected its just mac chrome that is odd… I think there are other special chars that are a problem in wikipedia, (,) and perhaps [ ] spring to mind.

(lid) #6

I couldn’t find a test link with []

() works on chrome windows
"Internet troll - Wikipedia"

(Jens Maier) #7

The custom URL sanitizer was broken. Apostrophes should not be replaced with ' as the HTML sanitizer will double-escape the ampersand. I’ve changed it to instead replace apostrophes with their URI-encoded representation %27.


(Sam Saffron) #8

Nice, this fixed my issue :slight_smile:

(Sam Saffron) #9