Support » Plugin: Amazon Associates Link Builder » Problem with accents and the content_filter rendering

  • Hi !
    I noticed on my whole site that when I have an amazon link, all the accents and special characters are affected by wrong charset. It doesn’t affect page title part.

    Check https://frenchw.net/test/ for example.
    Title is “TEst et détails diplôme” and is rendered correctly
    Content contains “Détail de l’offre proposée” and is rendered ‘DéTAIL DE L’OFFRE PROPOSéE’ (if’s in H3)
    it’s because I have just after a simple link:

    <a href="https://www.amazon.co.uk/XCSOURCE-10pcs-Cleaning-Cameras-DC580/dp/B00TF9AIF4/ref=as_li_ss_il?crid=GDR8TUWFJRRM&keywords=apsc+sensor+cleaning+kit&qid=1571894469&sprefix=apsc+senso,kitchen,147&sr=8-9&linkCode=li2&tag=frw-blog-21&linkId=cf78e38798c1ab389c36fb89376e461e" target="_blank" rel="noopener noreferrer"><img border="0" src="//ws-eu.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=B00TF9AIF4&Format=_SL160_&ID=AsinImage&MarketPlace=GB&ServiceVersion=20070822&WS=1&tag=frw-blog-21"></a><img src="https://ir-uk.amazon-adsystem.com/e/ir?t=frw-blog-21&l=li2&o=2&a=B00TF9AIF4" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;">

    If I use the new Guttenberg tag, it’s OK but I can’t use it everywhere.

    <!-- wp:amazon-associates-link-builder/aalb-gutenberg-block {"shortCodeContent":"[amazon_link asins='B01JJ1VDQK' template='FW-ProductAd' store='frw-blog-art-21' marketplace='FR' link_id='c814875f-8a6e-4d93-8f84-c641af82fbcc']","searchKeyword":"B01JJ1VDQK card"} /-->

    CAUSE

    after searching all around, I found the cause. It’s in /plugins/amazon-associates-link-builder/rendering/content_filter.php
    A regex searches the page content for amazon urls and makes some changes.
    In this file, and to match the example just above, If I change in
    private static $AMAZON_DOMAINS = array(......
    … the “amazon.co.uk” string to… lets say… “amazon.com.uk” then regex doesn’t match and my page is rendered correcty.

    I’m not a good php developper and I can’t find easily why this code changes the accents contened in the page:

            //Remove noreferrer form amazon anchor links
            foreach ( $anchor_node_list as $anchor_node ) {
                if ( $this->has_amazon_link( $anchor_node ) ) {
                    $this->remove_noreferrer( $anchor_node );
                    $content_updated = true;
                }
            }
    
            return $content_updated ? $document->saveHTML() : $content;

    I’m available for better testing
    best regard.

    • This topic was modified 2 years, 7 months ago by FrenchW.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter FrenchW

    (@frenchw)

    Note : you may not see the problem on my site as I edited the file to get rid of the problem:

    `class Content_Filter {
    private static $AMAZON_DOMAINS = array(
    ‘aaaa-amazon\.com’,
    ‘aaaa-amazon\.fr’,
    ‘aaaa-amazon\.it’,
    ‘aaaa-amazon\.de’,
    ‘aaaa-amazon\.es’,
    ‘aaaa-amazon\.com\.br’,
    ‘aaaa-amazon\.ca’,
    ‘aaaa-amazon\.cn’,
    ‘aaaa-amazon\.in’,
    ‘aaaa-amazon\.co\.jp’,
    ‘aaaa-amazon\.com\.mx’,
    ‘aaaa-amazon\.co\.uk’,
    ‘aaaa-amazon\.com\.au’,
    ‘aaaa-amzn\.to’

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with accents and the content_filter rendering’ is closed to new replies.