We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17883
    • 1,039 Posts
    If ssetting the format to ’rss’ the generated output isn´t valid XML. This occurs mainly with handling "german Umlaute" like äüöÄÜÖ etc. but surely this is also a problem for french or japanese or... I identified the lines where the problem is:

    ditto.class.inc.php line 208/209:

    $placeholders['[+rsspagetitle+]'] = htmlentities($resource['pagetitle'], ENT_QUOTES, $modx->config['etomite_charset']);
    $placeholders['[+rssusername+]'] = htmlentities($this->getCreatedBy($resource['createdby'], $format), ENT_QUOTES, $modx->config['etomite_charset']);


    this is wrong, because you create entities but in a XML file there musn´t be entities. But removing all entities isn´t all, because then you have a problem with possible ampersands in the title (like "Copy&Paste") which aren´t escaped. So my solution is:

    $placeholders['[+rsspagetitle+]'] = htmlspecialchars(html_entity_decode($resource['pagetitle'], ENT_QUOTES));
    $placeholders['[+rssusername+]'] = htmlspecialchars(html_entity_decode($this->getCreatedBy($resource['createdby']), ENT_QUOTES));


    I am aware of the losing the charset declaration, but html_entity_decode didn´t work on my PHP 4.4.2 with it. But my generated output is correct and valid (I have an UTF-8 charset). Okay not completely valid because my e-mail isn´t shown rolleyes

    See http://www.mademyday.de/neu/ for the site and http://www.mademyday.de/neu/index.php?id=5 for the generated RSS.

    Added to the tracker #507

    Cheers,
    Marc
      • 18397
      • 3,250 Posts
      MARKSVIRTUALDESK Reply #2, 20 years ago
      Try out the new Ditto 1.1 Beta 1 as I included your changes in the codebase.