matej_suchanek added a comment.

  Internally, the comment is stored as `/* 
clientsitelink-update:0|nlwiki|nlwiki:Koninklijk erkende Fanfare "St. Cecilia", 
Bocholtz|nlwiki:Fanfare St. Cecilia Bocholtz */`. This is fine.
  The unwanted escaping happens when the `/* ... */` part is magically 
transformed, probably in `AutoCommentFormatter::formatAutoComment`:
  
    // no message requires wikitext params and some args are user-controlled
    $args = array_map( 'wfEscapeWikiText', $args );
    
    // render the autocomment
    $auto = $msg->params( $args )->parse();
  
  At first, I thought the quotes are first escaped by `wfEscapeWikiText` and 
second by `Message::parse`... but in fact, //they are escaped earlier// and 
`wfEscapeWikiText` is the second time.
  
  In core, `CommentFormatter::preprocessRevComment` calls 
`CommentParser::preprocess` which calls `CommentParser::preprocessInternal` 
with `$unsafe = false` and that calls `Sanitizer::escapeHtmlAllowEntities` 
which includes this:
  
    # It seems wise to escape ' as well as ", as a matter of course.  Can't
    # hurt. Use ENT_SUBSTITUTE so that incorrectly truncated multibyte 
characters
    # don't cause the entire string to disappear.
    $html = htmlspecialchars( $html, ENT_QUOTES | ENT_SUBSTITUTE );
  
  So this is the first escaping which treats `'` (see T187912 
<https://phabricator.wikimedia.org/T187912>) and `"` in particular. It actually 
does hurt...

TASK DETAIL
  https://phabricator.wikimedia.org/T187755

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: matej_suchanek
Cc: ItamarWMDE, matej_suchanek, Lydia_Pintscher, gerritbot, thiemowmde, 
Aklapper, Bugreporter, Astuthiodit_1, Susie413113, karapayneWMDE, Invadibot, 
Gaurav24072002, Abhinay76, Annysah01, Rohitgeddam, maantietaja, Akuckartz, 
Soda, Chaytanya, JorisDarlingtonQuarshie, wiki-helenatxu, Dinadineke, 
DannyS712, Klein, Nandana, Tks4Fish, lucamauri, Mh-3110, tabish.shaikh91, Lahi, 
Gq86, GoranSMilovanovic, Jayprakash12345, JakeTheDeveloper, QZanden, merbst, 
LawExplorer, _jensen, rosalieper, xSavitar, Scott_WUaS, MuhammadShuaib, 
Wong128hk, Tmalhotra, SimmeD, Wikidata-bugs, aude, TheDJ, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org

Reply via email to