View Issue Details

IDProjectCategoryView StatusLast Update
0000828HTML & PERLBug Report - Databasepublic2018-09-14 18:55
Reporterninjamask Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Status newResolutionopen 
Summary0000828: Don't flipp apostrophes ' into backticks `
DescriptionCurrently all (') are flipped into (`). To be precise, such a change makes all AniDB text look like written by someone who didn't have a single clue about proper English.
Additional Informationhttp://forum.anidb.net/viewtopic.php?f=4&t=6846

Quoting Exp:
"It has nothing to do with perl.
It is a legacy issue back from the times when we didn't use prepared statements for SQL lookups.

The problem with removing it is that:
a) we'd need to do a complete code review, ensuring that there are no non-prepared statements left. (quite a task, considering the current size of anidb's code base)
b) we'd need to convert all entries in the db
c) we'd need to hunt down all places where the conversion is done. (not as easy as it might sound, think AniDB Clients)

All in all this isn't something which can easily be done.

BYe!
EXP"
TagsNo tags attached.

Relationships

related to 0000258 closed Imposible to add an apostroph to the database 
related to 0001581 closedDerIdiot Forum: '\' characters turn to '/' 

Activities

DerIdiot

2008-04-08 15:32

administrator   ~0001938

this problem is definitely not easy resolveable. would require for a complete audit of the whole code.
it's done because exp either didn't knew how to escape or didn't trust it. eitherway not easily done.

kd3

2008-12-02 04:58

reporter   ~0002436

How about a simple conversion just for the website display code?

Any clients can (and should!) handle it on their own.

//anidb converts ' to `, fixing that and making sure any other strings are safe for HTML
function safeprint($s) {
 return htmlspecialchars(str_replace('`',"'",$s),ENT_QUOTES);
}

havoc77

2009-02-25 03:53

reporter   ~0002567

Some simple javascript can fix it for certain pages. Since the Episode names are all inside <label> tags, this will work for when viewing a single Anime:

  // restrict script to run only when viewing a single anime's page
  if ( document.URL.indexOf("show=anime") > 1 && document.URL.indexOf("aid=") > 1 )
  {
    // only replace text inside labels - this should hopefully not mess with any javascript
    var labels = document.getElementsByTagName('label');

    if (labels)
    {
      for (var i = 0; i < labels.length; i++)
      {
        labels[i].innerHTML = labels[i].innerHTML.replace(/`/g,"'");
      }
    }
  }


Also you could add a new option in the user's preferences page to enable this so existing users are not effected.

Hazzard

2010-06-10 12:12

reporter   ~0003099

( ā€™ ) Punctuation apostrophe (or typographic apostrophe; right single quotation mark; single comma quotation mark), U+2019. Serves as both an apostrophe and closing single quotation mark. This is the preferred character to use for apostrophe according to the Unicode standard.

see http://en.wikipedia.org/wiki/Apostrophe#Computing

The grave accent could easily be replaced with this correct punctuation apostrophe. It would be typographicaly correct and it's not used as a special sign in sql or whatever.

DerIdiot

2010-06-10 20:35

administrator   ~0003101

[ 22:01:24 ] [ DerIdiot ] *poke*
[ 22:02:09 ] [ rar ] *wiggle*
[ 22:02:37 ] [ DerIdiot ] considering you were one of the "masterminds" behind the main title = ascii restriction i got some beef with ya
[ 22:03:03 ] [ rar ] hey, fix exp's ' -> ` then come after me
[ 22:03:13 ] [ DerIdiot ] i was going to replace ` with ā€™
[ 22:03:18 ] [ DerIdiot ] but ā€™ is an unicode char
[ 22:03:20 ] [ rar ] that's a bigger more pervasive crime
[ 22:03:32 ] [ rar ] yeah, and it's a bad idea anyway
[ 22:03:36 ] [ DerIdiot ] because?
[ 22:03:44 ] [ DerIdiot ] everyone and their dog tells me it's the preferred way
[ 22:03:47 ] [ rar ] that's a fullwdith character in my font, for instance
[ 22:04:10 ] [ DerIdiot ] U+2019
[ 22:04:39 ] [ rar ] blame the mappings the unicode consortium drew up
[ 22:04:39 ] [ DerIdiot ] 0027 APOSTROPHE
[ 22:04:39 ] [ DerIdiot ] = apostrophe-quote (1.0)
[ 22:04:39 ] [ DerIdiot ] = APL quote
[ 22:04:40 ] [ DerIdiot ] * neutral (vertical) glyph with mixed usage
[ 22:04:40 ] [ DerIdiot ] * 2019 is preferred for apostrophe
[ 22:04:42 ] [ DerIdiot ] http://unicode.org/Public/UNIDATA/NamesList.txt
[ 22:05:14 ] [ rar ] yeah, they say that, but then look at what it maps to in EUC-JP, shift-jis, etc etc
[ 22:05:53 ] [ rar ] all their "prefer this character over simple ascii thing" is total bollocks
[ 22:06:06 ] [ rar ] you're nearly always better off using the simple option
[ 22:06:09 ] [ DerIdiot ] you aren't making my life easier

Dagger

2010-07-03 04:10

reporter   ~0003107

Greasemonkey script to fix this on the client side:

// ==UserScript==
// @name AniDB ` fixer
// @namespace http://anidb.net/up20756
// @include http://anidb.net/*
// ==/UserScript==

var nodes = document.evaluate('//*/text()[contains(.,"`")]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
for (var i = 0, node; node = nodes.snapshotItem(i); i++)
    node.textContent = node.textContent.replace(/`/g, "'");

Posting this here in case it's useful for anyone.

Could a similar bodge be used server-side? Doing a similar search and replace on any read-only pages would make them look OK without requiring changes to the database, which would be a good first step. This could also be done in the AJAX javascript, just after it reads data from the server. Only some parts of some pages would be affected then but it would at least be an improvement on the current situation.

chortos-2

2018-09-14 18:55

reporter   ~0004284

Hey, Iā€™m seeing apostrophes (U+0027) now! Has this been resolved (hooray, congrats and thanks!), or have I done something on my side to work around it and then forgotten?

Issue History

Date Modified Username Field Change
2007-12-02 21:06 ninjamask New Issue
2007-12-06 08:12 epoximator Relationship added related to 0000258
2008-04-08 15:29 DerIdiot Status new => acknowledged
2008-04-08 15:32 DerIdiot Note Added: 0001938
2008-12-02 04:58 kd3 Note Added: 0002436
2009-02-25 03:53 havoc77 Note Added: 0002567
2010-06-10 12:12 Hazzard Note Added: 0003099
2010-06-10 20:35 DerIdiot Note Added: 0003101
2010-07-03 04:10 Dagger Note Added: 0003107
2010-09-29 15:13 DerIdiot Relationship added related to 0001581
2016-09-03 12:14 DerIdiot Status acknowledged => new
2018-09-14 18:55 chortos-2 Note Added: 0004284