php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

decoding subjects behaves differently if they contain special chars vs. them not containing special chars (GMAIL)

Open oe-leonhard opened this issue 1 year ago • 1 comments

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->subject of a message where subject is um zu läuten => which will lead to decoded subject um_zu_läuten
  • echo $message->subject of a message where subject is um zu läuten! => which will lead to decoded subject um 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.

oe-leonhard avatar Jun 12 '24 14:06 oe-leonhard

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,

Webklex avatar Jan 17 '25 21:01 Webklex