php-imap
php-imap copied to clipboard
decoding subjects behaves differently if they contain special chars vs. them not containing special chars (GMAIL)
Describe the bug
When using iconv as message subject decoding option, subjects not containing a special character but containing an Umlaut, will lead to the subject to have _ instead of blanks.
Subjects that contain both special chars and at least one umlaut though, will be decoded properly and result in blanks staying blanks.
Used config
Standard config except that decoders.message.subject is set to iconv
Code to Reproduce set above mentioned config and then:
echo $message->subjectof a message where subject isum zu läuten=> which will lead to decoded subjectum_zu_läutenecho $message->subjectof a message where subject isum zu läuten!=> which will lead to decoded subjectum zu läuten!
Expected behavior
Blanks should stay blanks after decoding, therefore no _ getting into the subject during decoding.
Server:
- OS: alpine 3.19.1
- PHP: 8.2
- Version 5.5.0
- Provider: Gmail
Additional context I'm using the laravel wrapper, using laravel 10.
Observation:
If omitting the decoder.message.subject option comletely, therefore getting undecoded subjects, and then using iconv_mime_decode directly, does NOT lead to blanks getting replaced with _ however for the sake of keeping code short and clean, I would prefer the package to handle decoding properly and consistent over me using iconv_mime_decode all over the place.
Hi @oe-leonhard , many thanks for the report. Please provide some examples or dummy emails or even a failing test case to demonstrate and replicate the issue. I'm unfortunately unable to diagnose the issue without any of those information.
Best regards & happy coding,