edsu / anon

tweet about anonymous Wikipedia edits from particular IP address ranges
Creative Commons Zero v1.0 Universal
975 stars 152 forks source link

Escape hashtags in article names #116

Closed cooljeanius closed 9 years ago

cooljeanius commented 10 years ago

For example, in this tweet: https://twitter.com/congressedits/status/496684262142537728 The "/" in the original article title somehow got turned into a "/" in the tweet, which twitter treats as a hashtag. I assume this has something to do with character set encoding conversion issues...

edsu commented 10 years ago

I've noticed this too, and have been meaning to fix it.

harryh commented 10 years ago

FYI here is another example of this happening:

https://twitter.com/valleyedits/status/499761297509322752

HeatfanJohn commented 10 years ago

Not sure if this is the same issue. I created a ranges entry with a name that contained the ampersand character and the resulting tweets had the ampersand encoded as "&".

"ranges": {
    "AT&T Public WiFi (Carnival Corp)": [
    "12.xxx.xxx.xxx"
    ]
}

Here's the resulting tweet:

https://twitter.com/myrasp_pi/status/499955022315012096

image

HeatfanJohn commented 10 years ago

I corrected my problem by changing the template config tag to use the triple mustache to render unescaped HTML, here what my template looks like:

"template": "{{{page}}} Wikipedia article edited anonymously from {{{name}}} {{&url}}"

Changing the page identifier to use the triple mustache should correct the original problem reported.

Here's the resulting tweet:

https://twitter.com/myrasp_pi/status/500036886128123905

image

lokal-profil commented 10 years ago

A similar issue exists for apostrophees where the tweet about John-Joe O'Toole becomes

remagio commented 10 years ago

Another example where page title looks "L'Ora" instead of "L'Ora" https://twitter.com/ItaGovEdits/status/517256445742821376

Articolo Wikipedia 'L'Ora' modificato anonimamente da Senato della Repubblica http://it.wikipedia.org/w/index.php?diff=68427526&oldid=67690486&rcid=82902613
edsu commented 9 years ago

I believe this is fixed now, if you update the templates in your config files to use triple braces. E.g.

 "template": "{{{page}}} Wikipedia article edited anonymously from {{{name}}} {{&url}}",

instead of:

"template": "{{page}} Wikipedia article edited anonymously from {{name}} {{&url}}",

Thanks @lokal-profil

lokal-profil commented 9 years ago

Credit goes to @HeatfanJohn who figured it out