Webpages displaying \u2019 instead of an apostrophe
For a long time, I often see that the apostrophe is not displayed but the code "\u2019" is there instead. It happens enough that I almost read past it as if it was correct english.
For example, a quoted Tweet on this site is shown as: "You clearly didn\u2019t bother to read her reply to him lol! " https://www.comicsands.com/aoc-clapback-musk-zuckerberg-twitter-2657252397.html
Seems to only be apostrophes. Ellipses, colons, quotations, brackets, dashes all appear fine.
I saw an article regarding Thunderbird that seemed very similar but didn't see much to help me. (questions/1312056). I saw a post about FF not using the Symbols font but that didn't help and I can't see how this should be a font issue (especially Symbol v. apostrophe).
Is there a way to fix it? The issue maybe due to the way the website is publishing quotes--I checked and found apostrophes appearing correctly on that page in the article headline and body text. The error is only inside the posted quotes.
Also, I don't see the pics of the quoted Tweets, just the text and I have to click on the date of the post to go to Twitter to see any graphic. Maybe that will help figure out what the apostrophe error is or maybe it is a second error/issue?
I run NoScript and uBlock Origin but I don' see any setting that would cause an issue. (uBlock is not blocking remote fonts. Twitter.com is not blocked by NoScript).
I'm no computer programmer or web designer but I find it hard to believe that an apostrophe should cause such a silly error.
Thank you.
All Replies (2)
"\u2019" is not the proper way to represent an Unicode character. I'm seeing a lot of cases on the page with such Unicode characters and "\u2019" is not the only.
A possible bookmarklet is something like this. You can create a new bookmark and paste the full JavaScript code in its URL field. If you load extra content by scrolling down then you need to invoke the bookmarklet another time in you notice "\uXXXX" codes. This fixes newline (\n) codes as well.
javascript:void(document.body.innerHTML=document.body.innerHTML.replace(/\\u([0-9a-f]{4})/g,r=>unescape(r.replace(/\\u([0-9a-f]{4})/,'%u$1'))).replace(/\\n/g,'\n'))
I created a bookmark as you suggested and it does seem to work. It is a manual correction but does make reading the page a bit easier.
Thank you for you time and great suggestion.
I think I'll try to send the webmaster of that site a link to this topic and maybe they'd be intrigued enough to find a better method to post quotes on their site.
Thank you again!