Support » Plugin: Amazon Associates Link Builder » Encoding-issue: Umlauts problem, when noreferrer removal is active

  • Hi there!

    A client of me uses this plugin. When the following option is active, there german umlauts are not displayed correct:

    Remove rel="noreferrer" for Amazon Affiliate Links from all posts

    So “ä” gets “ä”.

    It seems, that there is somwhere an encoding-change in place, which is causing this problem.

    Where can I look for the origin of this Problem? is it also seen on other Pages?

    Best Regards,

    Stefan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    I have the same problem on my site, but not with all posts / pages in my wordpress instance. I can’t find a difference or “pattern” with those posts “working / not working”.

    Functionality should be maybe in plugins/amazon-associates-link-builder/rendering/content_filter.php .

    Andreas

    … yes, there it is, after content filter, the dom encoding is corrupted. I found a hint at php doc

    
    //https://stackoverflow.com/questions/1148928/disable-warnings-when-loading-non-well-formed-html-by-domdocument-php
    //Disable warnings generated while parsing
    $libxml_previous_state = libxml_use_internal_errors( true );
    //Parse the Html Document
    $document->loadHTML('<?xml encoding="UTF-8">' . $content );
    
    // dirty fix
    foreach ($document->childNodes as $item)
        if ($item->nodeType == XML_PI_NODE)
            $document->removeChild($item); // remove hack
    
    $document->encoding = 'UTF-8'; // insert proper

    Not pretty, but after this change, the option can be set without problems. tbc

    Andreas

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.