@matoca, thanks for that information. It helps to validate my theory and try to find a good solution.
Karen,
So the UTF-8 code uses quoted-printable encoding by default. We can try to change that to base64 and see if that’ll work. At this stage, I’m mainly wondering if the server is acting up with any encoding scheme or just quoted-printable.
Please add the following to your functions.php file.
function my_subject_base64( $prefs )
{
$prefs['scheme'] = 'B';
return $prefs;
}
add_filter( 'bbpnns_subject_enc_preferences', 'my_subject_base64', 10, 1);
The downside is that extensions such as WP Email Logging will have totally unreadable subject lines.
Please let me know if that works.
-
This reply was modified 5 years, 8 months ago by
useStrict. Reason: Added instructions on where to place the code
Sorry for delay in reply
Our system is on Krystal web site I think our domain is running on a litespeed web server running CloudLinux OS.
Karen
Hi Karen,
What about the email? Do you use the server’s email system or do you connect to an external one?
I’m also experiencing this same issue.
Email notifications have the Subject line:
=?UTF-8?Q?[BuildMyBrandiD]=20New=20Forum=20topic:=20No=20hamburge?= =?UTF-8?Q?r=20menu=20for=20mobile=20site?=
The content of the email is fine and displays correctly.
This started about a week or two ago.
Please help! Thanks in advance!
We use the standard Unix mail server supplied by Krystal.
Karen
To Alexmustin – I think you just need to set UTF encode off
@alexmustin, thanks for reaching out.
Let’s try to find a common denominator.
1. What PHP version are you using?
2. What WordPress version are you using?
3. Can you try to downgrade to bbpnns version 2.10 or even 2.9.5.1 and let me know if it’s still happening? You can download the older versions from https://ww.wp.xz.cn/plugins/bbpress-notify-nospam/advanced/
@kbaldac, setting UTF-8 off will definitely stop the encoding issue, but it will also not convert any html entities that may be added to the title.
Because I cannot replicate the problem, we need to find the common denominator for everyone facing this issue so I can find the root cause and fix it.
Here’s another test we can try (again, sorry for asking this but as I cannot replicate the issue locally, I have no other option).
Original code:
if ( true === $do_enc && function_exists( 'iconv_mime_encode' ) )
{
/**
* Enable UTF-8 characters in subject line
* @since 1.9
*/
$filtered_subject = iconv_mime_encode( 'Subject', html_entity_decode( $filtered_subject ), $preferences );
$filtered_subject = substr( $filtered_subject, strlen( 'Subject:' ) );
}
New code:
if ( true === $do_enc )
{
/**
* Enable UTF-8 characters in subject line
* @since 1.9
*/
if ( function_exists('mb_encode_mimeheader') )
{
$filtered_subject = mb_encode_mimeheader( html_entity_decode( $filtered_subject ), $preferences['input-charset'], $preferences['scheme'] );
}
elseif ( function_exists( 'iconv_mime_encode' ) )
{
$filtered_subject = iconv_mime_encode( 'Subject', html_entity_decode( $filtered_subject ), $preferences );
$filtered_subject = substr( $filtered_subject, strlen( 'Subject: ' ) );
}
}
It tries to use mb_encode_mimeheader() if that function is available. It is a bit different from what iconv_mime_encode() does and I’m not sure if it’ll work or not.
Please let me know how it goes.
Cheers,
Vinny
-
This reply was modified 5 years, 8 months ago by
useStrict. Reason: Removed extra indentation from code snippets
This code appears to have an error in it – the { below is flagged
if ( function_exists('mb_encode_mimeheader') )
{
I am not a very experienced php coder, so don’t know what is wrong – I used copy and paste from your email
karen
Hi Karen,
Please make sure that the apostrophes haven’t been replaced by curly quotes or entities (that’s what I see in the email: ' instead of ‘).
-
This reply was modified 5 years, 8 months ago by
useStrict.
-
This reply was modified 5 years, 8 months ago by
useStrict. Reason: trying to show the entity instead of the character
It won’t let me write out the full entity. What I meant was & #039; (without the space)
Managed to get changes in the code ok and tested with UTF off and on
Seemed to make no difference
We appreciate your persistance but as long as we keep UTF off , the only time we get a problem is if a member uses double quote in the topic title. This happens rarely so we can live with it
Karen
Thanks for working with me, Karen. I’ve posted a question in StackOverflow to see if anyone has any pointers.
I’ll update this thread once I have something.
Hi @kbaldac,@matoca,
It took me a while to track this one down, but I think I finally have a decent fix for it.
Please update to v2.14 and let me know if you still see the issue.
Cheers,
Vinny
Hi Vinny
Your fix for the Subject line UTF-8 encoding error when using quotes works well. Many thanks for the work you put into it.
Kind regards
Robert Sterry [Guild of One-Name Studies Web Team]