• Resolved wpturk

    (@wpturk)


    Subject of my emails which include the post title shows strange characters/codes whenever title includes apostrophe. How can I convert the subject lines to UTF8?

    The body of emails are fine. Problem is only the subject lines.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Markus Echterhoff

    (@mechter)

    This is a bug. Thanks for reporting it!

    I just released an update. Please give the new version a try.

    Thread Starter wpturk

    (@wpturk)

    Hi Markus,

    Thanks for your quick response. I updated to 3.4 , unfortunately I still have the problem.

    Plugin Author Markus Echterhoff

    (@mechter)

    Are you by any chance using one of the filters to modify the email subject?

    Thread Starter wpturk

    (@wpturk)

    No, I only use this filter you gave me:

    https://wordpress.org/support/topic/admin-notification-11/

    Plugin Author Markus Echterhoff

    (@mechter)

    I can no longer reproduce the issue. Apostrophes look just fine in email subjects over here.

    Could you validate that in your asynchronous-bbpress-subscriptions.php line 8 reads Version: 3.4 and the code in line 108 starts with $topic_title = wp_specialchars_decode(...? This is what the line looks like if fixed.

    If that checks out, could you please also validate that no other active plugin or theme use any of the following filters: abbps_topic_subject, bbp_forum_subscription_email_subject, or bbp_forum_subscription_mail_title? Alternatively, you could test this in a fresh installation running a default theme where the only active plugins are bbPress and AsynCRONous bbPress Subscriptions.

    Plugin Author Markus Echterhoff

    (@mechter)

    Please also make sure that AsynCRONous bbPress Subscriptions is actually active because it would seem the bug is also present in the current version of bbPress. If you disabled my plugin for some reason, apostrophes and other special characters would appear as html entities in email subjects.

    Thread Starter wpturk

    (@wpturk)

    I can confirm that asynchronous-bbpress-subscriptions.php line 8 reads Version: 3.4 and the code in line 108 starts with $topic_title = wp_specialchars_decode(…

    AsynCRONous bbPress Subscriptions is also active.

    I don’t use “abbps_topic_subject, bbp_forum_subscription_email_subject, or bbp_forum_subscription_mail_title” filters.

    In my installation, Unfortunately I still see apostrophe as special chatacters in the subject lines.

    • This reply was modified 6 years, 3 months ago by wpturk.
    • This reply was modified 6 years, 3 months ago by wpturk.
    • This reply was modified 6 years, 3 months ago by wpturk.
    Plugin Author Markus Echterhoff

    (@mechter)

    In the unmodified version of your latest reply you have included the entity code for the apostrophe you have used. These forums decode entity codes into their corresponding characters (which is why I also removed an entity code from my previous reply), but it was present in the notification email I got. Comparing both of our now removed apostrophe entity codes I noticed that mine was the typewriter apostrophe ( ‘ ) with code 039 and yours was the typographic apostrophe ( ’ ) with code 8217. The typographic apostrophe should already have been working normally this whole time because it is not a special character!

    Perhaps this is an issue with character encoding? Is all of your setup UTF-8 or are some parts working in a different character set?

    I have set up a minimal test installation and came up with a rather complicated way to reproduce your problem. If I enter the entity code ( & # 8 2 1 7 ; ) (without the spaces) in the topic title, it is not decoded to the typographic apostrophe in the email subject but shows up correctly on the page. Note that if I enter the character itself, it displays just fine even in the email.

    Could it be that you somehow enter html entities to begin with? Do you type the apostrophe yourself or do you copy and paste it from some rich text editor?

    If you are entering the typographic apostrophe character regularly, then something must be escaping entities before or after reading the post title from the database. In order to test that, please deactivate everything but a standard theme, bbPress and AsynCRONous bbPress Subscriptions (or create a fresh installation for testing as I did). Does it work then?

    If you can access the database with an admin tool, you can also check the following: The column post_title of the topic’s row in the wp_posts table should contain the character ( ’ ) rather than the entity code ( & # 8 2 1 7 ; ) (without the spaces). If the database contains the entity code, it has either been entered as an entity code or was modified before being stored.

    The problem could also be the browser, a browser extension, an issue with the webserver or php… but that would seem even more unlikely.

    Please give it a thorough testing so we can get to the bottom of this. If we can’t find the cause, we’ll come up with a workaround.

    • This reply was modified 6 years, 3 months ago by Markus Echterhoff. Reason: trying to display html entities
    Thread Starter wpturk

    (@wpturk)

    First test: The title is correctly stored in the database.

    mysql> select post_title from forum_posts where id="54972" ; 
    +--------------------------------------------------+
    | post_title                                       |
    +--------------------------------------------------+
    | Vancouver'da Ev Alırken En Sık Yapılan 3 hata    |
    +--------------------------------------------------+
    1 row in set (0.00 sec)
    Thread Starter wpturk

    (@wpturk)

    Second test: Changing browser.

    I was using Safari, now I tried to post with Firefox.

    The same issue: & # 8 2 1 7 ; in subject line.

    Plugin Author Markus Echterhoff

    (@mechter)

    This is interesting! Your database contains the & # 0 3 9 ; typewriter apostrophe, whereas your subject line contains the & # 8 2 1 7 ; typographic apostrophe. If these tests are for the same bbPress topic, it would seem that your theme or some other plugin is running wptexturize() on the topic title, possibly via the the_title filter.

    To find out, either debug the code directly if you know how, or switch to a standard WordPress theme and deactivate plugins until you find the culprit. Then I could look into it and provide you with a workaround.

    Thread Starter wpturk

    (@wpturk)

    Here search for wptexturize:

    .../forum/wp-content# find . | xargs grep wptexturize
    ./plugins/bbpress/includes/core/filters.php:add_filter( 'bbp_get_reply_content', 'wptexturize',        6  );
    ./plugins/bbpress/includes/core/filters.php:add_filter( 'bbp_get_topic_content', 'wptexturize',        6  );
    ./plugins/bbpress/includes/core/filters.php:add_filter( 'bbp_get_topic_author_display_name', 'wptexturize'   );
    ./plugins/bbpress/includes/core/filters.php:add_filter( 'bbp_get_reply_author_display_name', 'wptexturize'   );

    Filters are not for the title. By the way, I use bbpress 2.6 RC7.

    Plugin Author Markus Echterhoff

    (@mechter)

    There was indeed a wptexturize call added to the the_title filter hook but for some reason it did not execute under all circumstances, which is why I was unable to reproduce the issue. I think I fixed it for good though. Give version 3.5 a try. The bug has been reported to bbPress a couple of years ago (https://bbpress.trac.wordpress.org/ticket/2865) but was still present in the bbPress code I used to create this plugin.

    Thread Starter wpturk

    (@wpturk)

    Markus, works now!!! Thanks for your extraordinary support.

    Plugin Author Markus Echterhoff

    (@mechter)

    Awesome! Thanks for your patience and help in debugging this problem.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘emails come with strange characters in subject’ is closed to new replies.