yiioverflow / yii2-imap

https://yiioverflow.com
BSD 3-Clause "New" or "Revised" License
41 stars 33 forks source link

Decoding condition #13

Closed s1lver closed 6 years ago

s1lver commented 6 years ago

Hi!

The features of my server do not allow Mime-type preprocessing. In my case, it is necessary to give the received data as it is. And put the decoding on a third-party script.

Proposal: Add a setting depending on which to do or not preliminary decoding. Now I did so - everything works fine. Now I prepare the pull request.

protected function decodeMimeStr($string, $charset = 'utf-8') {
        $newString = '';
        $elements = imap_mime_header_decode($string);
        for($i = 0; $i < count($elements); $i++) {
            //This 
            /*if($elements[$i]->charset == 'default') {
                $elements[$i]->charset = 'iso-8859-1';
            }
            $newString .= $this->convertStringEncoding($elements[$i]->text, $elements[$i]->charset, $charset);*/
            $newString .= $elements[$i]->text;
        }
        return $newString;
    }