Domanda

I've a problem with koi8r charset with mimeDecode,

As an example:

Subject: =?KOI8-R?B?8NLJ18XUIQ==?= From: =?KOI8-R?B?4czFy9PBzsTSIPfPzMvP1w==?=

Becomes:

Subject: п÷я─п╦п╡п╣я┌! From: Александр Волков

It should be as follows,

Subject: Привет! From: Александр Волков

So the exact problem is

        if (is_string($this->_decode_headers)) {
            $conv = @iconv($charset, $this->_decode_headers, $text);
            $text = ($conv === false) ? $text : $conv;
        }

Thank you.

UPDATE Solved, the problem was email headers were saved to db in other charset.

È stato utile?

Soluzione

Don't you want to use mb_decode_mimeheader ?

iconv translates encoded strings, here your string is only ascii.

mb_internal_encoding("UTF-8");
$string = "=?KOI8-R?B?8NLJ18XUIQ==?=";
$conv = mb_decode_mimeheader($string);

This will work provided that you're sending utf-8 encoded string of course, otherwise you have to adapt the first command

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top