WordPress.org

Ready to get started?Download WordPress

Forums

Share and Follow
Ampersand breaks email share (3 posts)

  1. SEA7
    Member
    Posted 3 years ago #

    My client's blog is Letters & Lace and some posts have ampersands as well. The email share breaks unless I change the Title of the site to Letters 'n Lace and kill all ampersands in posts.

    Can you fix this? I can't be the only user with this problem.

    Thanks a lot!

    Stephen

    http://wordpress.org/extend/plugins/share-and-follow/

  2. goto10
    Member
    Posted 2 years ago #

    Hello,

    I'm using Share and Follow version 1.54.1, and characters are still not being properly encoded for use in emails. Can you please fix this problem?

    Here is some code that may help.
    (added to share-and-follow.php line 2024, right after the case "email": block)... (Of course it is very naughty to edit the plugin's code directly, so I'm hoping that a fix will be implemented in an update).

    $chars_search = array (
    	'’', 	// single curly quote
    	'“', 	// double curly quote open
    	'”', 	// double curly quote close
    	'…', 	// horizontal ellipsis
    	'&', 	// ampersand
    );
    $chars_replace = array (
    	'%27', 	// single curly quote
    	'%22',	// double curly quote open
    	'%22',  // double curly quote close
    	'%2E%2E%2E', // horizontal ellipsis
    	'%26', 	// ampersand
    );
    $page_title = str_replace( $chars_search, $chars_replace, $page_title );

    This snippet is just a start, but can easily be expanded to handle more characters and subjects.

    Thank you!

  3. goto10
    Member
    Posted 2 years ago #

    Note: The forum has messed with the code a bit. The strings within the $chars_search array should be the html entity numbers, such as this:

    & # 8 2 1 7;
    & # 8 2 2 0;

    ...but without spaces in between each character. See this reference.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic