WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Non-printable characters were found - Twenty Ten (7 posts)

  1. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi Guys,
    I uploaded a theme to the WordPress directory, and it was rejected, I corrected some isset() errors, and then looked at this one.

    Info: Non-printable characters were found in the D:\wamp\www\wordpress/wp-content/themes/atmosphere-2010/functions.php file. You may want to check this file for errors.

    I spent a good couple of hours and rebuilt the functions.php file function by function, and the error is caused by a Twenty Ten function, "twentyten_posted_on"

    I downloaded a clean "twenty ten 1.1" and the check Theme plugin gives the same error.

    Theme passed all the tests!

    * Info: Non-printable characters were found in the D:\wamp\www\wordpress/wp-content/themes/twentyten/functions.php file. You may want to check this file for errors.

    Twenty Ten Posted On Function:

    /**
     * Prints HTML with meta information for the current post—date/time and author.
     *
     * @since Twenty Ten 1.0
     */
    if ( ! function_exists( 'twentyten_posted_on' ) ) :
    
    function twentyten_posted_on() {
    	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
    		'meta-prep meta-prep-author',
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
    			get_permalink(),
    			esc_attr( get_the_time() ),
    			get_the_date()
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    			get_author_posts_url( get_the_author_meta( 'ID' ) ),
    			sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    			get_the_author()
    		)
    	);
    }
    endif;

    I downloaded and re-installed WordPress as well, when I run the Theme Check plugin (this is the only one activate), I also get a message:

    Notice: get_plugin_data was called with an argument that is deprecated since version 3.0! The Site Wide Only: true plugin header is deprecated. Use Network: true instead. in D:\wamp\www\wordpress\wp-includes\functions.php on line 3321

    I am now unsure if it is the 'twentyten_posted_on' function or the 'theme test' plugin, anyone have any ideas?

    Regards

    David

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    The Info: Non-printable characters were found in the are in this comment code block, when I removed the comments the error went away.

    /**
     * Prints HTML with meta information for the current post—date/time and author.
     *
     * @since Twenty Ten 1.0
     */

    I still have the plugin message but changing the theme does not make that one go away, so that is plugin and not theme specific!

    Now all I need to do is fix the other bits, remove comments, test and re-submit!

    David :-)

  3. pszeinert
    Member
    Posted 3 years ago #

    The dash between "post" and "date" is a non-standard hyphen, likely added by Word or some other text formatting program. The code below is clean and would make TwentyTen the first theme I have run through the theme-checker to thoroughly validate.

    /**
     * Prints HTML with meta information for the current post-date/time and author.
     *
     * @since Twenty Ten 1.0
     */

    Since it is in a comment block, it would never throw errors.

  4. Digital Raindrops
    Member
    Posted 3 years ago #

    Wow great spot, the dash is in the twenty ten theme code, so not something I had done, what did you use to find it?

    I searched everywhere to find a tool to identify the non printable characters before posting here, and I was looking for hidden control characters.

    David

  5. pszeinert
    Member
    Posted 3 years ago #

    I got rid of individual lines within the code block you had identified (thanks by the way, that was very helpful). When I hit the line it was in, I looked for anything out of the ordinary. A few days ago we had to tell one of our authors to quit copy and pasting from Word because his em and en dashes (long and short dashes, not hyphens) were ruining our xml feed.

    The error wasn't ever going to show up in a live site, but it is nice when everything can be considered perfect; if even for a brief moment.

  6. Simon Prosser
    Theme Review Admin
    Posted 3 years ago #

    Hi, i am the authour of the theme-check plugin. Sorry I only just saw this post.
    Notice: get_plugin_data was called with an argument that is deprecated since version 3.0!
    I have a simple fix for this and i will upload a revision very shortly!

    A new version is in the works with all the guidelines for 3.1

  7. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi Pross,
    Great plugin, one I will use as I go from now on!

    Thanks for the reply, it is the first time I have used the plugin, so I was not sure about the message.

    The plugin works great, the problem with the messages like non-printable character and deprecated code calls, it is hard finding the line or lines with the errors.

    Just a polite request, would be for another page that names the file and line number where each fail was found.

    With the non-printable character it was not clear which line this was on, I checked lots of different packages and Googled pages, but there was no clear way of finding these characters.

    I had to move the lines from functions.php and add them back one block at a time, saving and running the theme test at each step, and it was the last but one block, and a comment line that was the problem.

    Another idea would be a page where a single file could be loaded and checked with any error code lines highlighted.

    Just floating idea's.

    Regards

    David

Topic Closed

This topic has been closed to new replies.

About this Topic