Welcome Guest, Not a member yet? Register   Sign In
E-Mail with UTF encoded Subject - if longer then expected length => becomes garbled in gmail
#1

[eluser]Ki[/eluser]
Hi,
I dont want to yell "BUG!!!" just because I have encountered this unexpected behavior BUT I noticed that email subjects with non-english characters (cyrillic) end up showing as "=d0=97=d0=95=d0" when they are longer then a certain length.
I was able to fix it by making 2 modifications to Email Class -> function _prep_q_encoding
Modifications (2):
Code:
for ($i = 0, $length = strlen($str); $i < $length; $i++)
        {
            // Grab the next character
            $char = substr($str, $i, 1);
            $ascii = ord($char);

            // convert ALL non-printable ASCII characters and our specials
            if ($ascii < 32 OR $ascii > 126 OR in_array($char, $convert))
            {
commented out this =>        //$char = '='.dechex($ascii);
            }

            // handle regular spaces a bit more compactly than =20
            if ($ascii == 32)
            {
and commented out this =>    //$char = '_';
            }

            // If we're at the character limit, add the line to the output,
            // reset our temp variable, and keep on chuggin'
            if ((strlen($temp) + strlen($char)) >= $limit)
            {
                $output .= $temp.$this->crlf;
                $temp = '';
            }

            // Add the character to our temporary line
            $temp .= $char;
        }

Here are my headers
With 'bad' email subject:

Subject: =?utf-8?Q?Objava: =d0=97=d0=95=d0=9c=d0=af =d0=a1=d0=9c=d0=95=d0=9b=d0?=
=?utf-8?Q?=9d=d0=98=d0=a6=d0=90?=

With 'fixed' email subject:

Subject: =?utf-8?Q?Objava: ЗЕМЯ СМЕЛНИЦА?=

Can someone comment on this
Is this a bug?
May I have other issues by commenting out those sections of the class (mentioned above)?

Ki


Messages In This Thread
E-Mail with UTF encoded Subject - if longer then expected length => becomes garbled in gmail - by El Forum - 06-11-2009, 09:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB