Convert embedded specified UTF-8 mail with text UTF-8

I want to convert the following raw message to plain text of UTF-8:

=? UTF-8? B UmU6ICMyLUZpbmFsIEFjY2VwdGFuY2UgdGVzdCB3aXRoIG5ldyB0ZXh0IHdpdGggU2xvdg ==? = =? UTF-8? B YWsgaW50ZXJwdW5jdGlvbnMgIivEvsWhxI3FpcW + w73DocOtw6khxYgi? =

The real text for this (yes, there are crazy diacritics in it):

Re: # 2-Final acceptance test test with new text with Slovak interferences "+ ľščťžýáíé! Ň"

Message Processing Method:

function subject_imapUtf8($str){ $conv = ''; $subParts = preg_split('/[\r\n]+/',$str); for($i=0;$i<count($subParts);$i++){ $conv .= imap_utf8(trim($subParts[$i])); } return $conv; } 

As an example, this gives me:

=? UTF-8? B UmU6ICMyLUZpbmFsIEFjY2VwdGFuY2UgdGVzdCB3aXRoIG5ldyB0ZXh0IHdpdGggU2xvdg ==? = ak interunctions "+ ľščťžýáíé! ň"

So, as you can see, the second part / line of the object is converted to a match.

What do I need to change to correctly convert the first part?

0
source share
1 answer
 mb_internal_encoding("UTF-8"); echo mb_decode_mimeheader($mime); 
+5
source

Source: https://habr.com/ru/post/1397302/


All Articles