Forums

Give help. Get help.

  • deb
    # September 4, 2017 at 11:46 pm

    Hi I really don’t know is this right place to ask the question but I have a weird problem, a square box appears on some paragraphs only on Windows – Chrome, everywhere its fine, you can’t see any empty square box on any other browsers, but on Windows -> Chrome, you can see some empty box. I have attached the screenshot might be you guys have that same problem too.

    Image: http://5903568321.com/squarebox.png

    Thanks

    # September 4, 2017 at 11:51 pm

    Looks like a character which cannot be found in the font you’re using. Are you sure there isn’t something in the text in that place?

    # September 5, 2017 at 3:14 am

    @deb It’s visible on Linux Chromium too. The character is in the actual HTML.

    As @jeroen-reijs says, the character doesn’t have a glyph in the font file you are using. In this instance it’s a U+0003 character. Just delete it from wherever you store that text on your server and it’ll be fixed.

    Odds are the original text was copied from a text editor, word processor or email client that inserted the character for its own display reasons.

    deb
    # September 5, 2017 at 3:43 pm

    Hi Ben & JeroenR

    thank you for the answer but is there any possible solution to remove all of it from the website, like creating any function to remove it. We get copy from Client and it won’t be possible to type again, so copy and paste the texts is the option. How shall i remove this weird U+0003 character?

    Thank you

    deb
    # September 5, 2017 at 5:16 pm

    Hi
    I have found it, it’s called ETX characters. When you are copying from Photoshop or Word doc, then you will also copy some weird ETX characters, it is better to copy from there and paste it in sublime text editor, it shows the ETX characters which is cool and other thing is you can create a function like this (this is for WordPress):

    function removeETX($content) {
    $content = preg_replace(‘/\x03/’, ”, $content);
    return $content;
    }

    add_filter(‘the_content’, ‘removeETX’);
    add_filter(‘the_title’, ‘removeETX’);
    add_filter(‘the_excerpt’, ‘removeETX’);

    Thank you

    # September 6, 2017 at 3:13 pm

    You’re welcome. However, your solution still leaves those characters behind, and if you changed your theme or your CMS you may well see the same problem again. A better solution would be to remove the characters at the point that they enter the database.

    I understand you don’t want to do it manually, but why not use a plugin with a hook at the point of saving rather than at the point of retrieval?

    I’m not a wordpress developer, so check the code before using it production, but a browse through the developer API gave me this.

    <?php
    /*
    Plugin Name: Detergent
    Version: 1.0.0
    */
    
    function scrub_a_dub_dub( $content ) {
        $content = preg_replace( '/\x03/', '', $content );
        return $content;
    }
    
    function apply_detergent( $post_id, $post, $update ) {
        $post->post_content = scrub_a_dub_dub( $post->post_content );
    
        remove_action( 'save_post', 'apply_detergent', 10, 3 ); // Avoid infinite loop
        wp_update_post( $post );
        add_action( 'save_post', 'apply_detergent', 10, 3 );
    }
    
    add_action( 'save_post', 'apply_detergent', 10, 3 );
    
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag