When sharing some items from mn using twitter, special characters are rendered wrongly (with their html code) for example

http://twitter.com/?status=I+unknowingly+registered+two+times+and+during+the+voter+display%2C+my+name+didn%26%23039%3Bt+return.+I+don%26%23039%3Bt+know+whether+I+will+get+my+voter%26%23039%3Bs+card+or+allowed+to+register.+Please+help+me.+I+am+Ssebuma+Emmanuel+%28http%3A%2F%2Fexampledotcom%2Fmanagingnews-1.1%2Fnewsitem%2F1772%29

Comments

Will White’s picture

Status: Active » Fixed
batje’s picture

Status: Fixed » Needs work

Hi Will,

Wow, that is quick. Here is an example

http://twitter.com/?status=I%20unknowingly%20registered%20two%20times%20and%20during%20the%20voter%20display,%20my%20name%20didn't%20return.%20I%20don't%20know%20whether%20I%20will%20get%20my%20voter's%20card%20or%20allowed%20to%20register.%20Please%20help%20me.%20I%20am%20Ssebuma%20Emmanuel%20

If i create a link here, the problem does not occur. Only from our managingnews installation (or when i copy th link through skype)

2 things can happen:
In the old twitter interface, the page is redirected and all characters before (and including) the first # are chopped of and you get a "Page not found"

In the new twitter interface, you just get a "page not found"

Getting there.

Will White’s picture

Status: Needs work » Fixed

Hi batje,
Again, this should be fixed. Did you try the patched I mentioned in #1?

batje’s picture

yes i did (eh, i wouldnt have reopened the issue if i didnt) and the behaviour is slightly different than yesterday. I made the change to the strongarm.inc file, updated the simpleshare with drush. And the described behaviour is what i get.

If you login to skype, you will get the URL that is causing the trouble in the same way i see it.

Will White’s picture

Status: Fixed » Active

Sorry, it wasn't clear that this was a separate issue. I'm not clear on what's wrong. Can you post the link the that Managing News now produces?

batje’s picture

Status: Active » Fixed

Hi Will,

its in #2. As you can see from there, the spaces are now %20 instead of + This works (for spaces), but the problem now moves to the '

Clicking the link in #2 is not showing what happens because d.o. mangles the link again. If you add me to skype (reinierbattenberg) the link as its generated here should reach you un-url-deandencoded and you should be able to reproduce the problem.

batje’s picture

Status: Fixed » Active
flatline2010’s picture

I am not sure if this is connected to this bug, but, whenever I try to twit a news that has a percent sign in the title, the twitter page does not load. The problem seems to be that even if the % sign is escaped to %25 (I tried this within the shortening url function) it is transformed back to a simple % causing the problem when generating the page. If I change it again in the browser url window to %25, it works.

I use bit.ly as shortener and the shorted url is correctly generated.

batje’s picture

I found an even easier way to reproduce this:

- install managingnews 1.2
- add this feed: http://www.observer.ug/index.php?format=feed&type=rss (that is pretty standard Joomla, i would say)
- hover over the title of the article: nice ampersands.
- hover over the simpleshare link: the ampersands are urlencoded and look like amersand+amp;
- click twitter
- follow the tinyurl that has been created (copy it from the twitter textbox on twitter.com)
- it fails

batje’s picture

I solved #9 (and might have solved the others too, it seems) by adding a fourth line to the $url manipulation in simpleshare_handler_field_link.advanced_render that reads:

$url = htmlspecialchars_decode($url);

Happy Tweeting!

batje’s picture

Status: Active » Needs review
flatline2010’s picture

It does not solve #8:

a news with title

Detrazione 55%, cosa cambia con la rateazione in 10 anni

results in

http://twitter.com/?status=Detrazione%2055%,%20cosa%20cambia%20con%20la%...

that does not load (but it would with 55%, => 55%25,)