From:             wiela at centras dot lt
Operating system: Windows XP HE
PHP version:      5.2.5
PHP Bug Type:     mbstring related
Bug description:  broken mb_encode_mimeheader()

Description:
------------
php v5.2.5, mb_encode_mimeheader(), both QP and base64 encoding schemes
incorrectly encodes utf-8 strings.

Reproduce code:
---------------
// $str1 and $str2 characters are in the Latin-Extended-A plane

// $str1 is 'utf-8' string, its base64_encode is:
// 'xITEjMSYxJbErsWgxbLFqsW9'
$str1 = "ĄČĘĖĮŠŲŪŽ";

// $str2 is 'utf-8' string, its base64_encode is:
// 'xIXEjcSZxJfEr8WhxbPFq8W+'
$str2 = "ąčęėįšųūž"; 

echo mb_encode_mimeheader($str1, 'UTF-8', 'Q');
echo mb_encode_mimeheader($str1, 'UTF-8', 'B');
echo mb_encode_mimeheader($str2, 'UTF-8', 'Q');
echo mb_encode_mimeheader($str2, 'UTF-8', 'B');

Expected result:
----------------
for $str1, QP encoding:
=?UTF-8?Q?=C4=84=C4=8C=C4=98=C4=96=C4=AE=C5=A0=C5=B2=C5=AA=C5=BD?=

for $str1, base64 encoding:
=?UTF-8?B?xITEjMSYxJbErsWgxbLFqsW9?=

for $str2, QP encoding:
=?UTF-8?Q?=C4=85=C4=8D=C4=99=C4=97=C4=AF=C5=A1=C5=B3=C5=AB=C5=BE?=

for $str2, base64 encoding:
=?UTF-8?B?xIXEjcSZxJfEr8WhxbPFq8W+?=



Actual result:
--------------
for $str1, QP encoding:
=?UTF-8?Q?=C3=84=C2=84=C3=84=C2=8C=C3=84=C2=98=C3=84=C2=96=C3=84=C2=AE?=
 =?UTF-8?Q?=C3=85=C2=A0=C3=85=C2=B2=C3=85=C2=AA=C3=85=C2=BD?=

for $str1, base64 encoding:
=?UTF-8?B?w4TChMOEwozDhMKYw4TClsOEwq7DhcKgw4XCssOFwqrDhcK9?=

for $str2, QP encoding:
=?UTF-8?Q?=C3=84=C2=85=C3=84=C2=8D=C3=84=C2=99=C3=84=C2=97=C3=84=C2=AF?=
 =?UTF-8?Q?=C3=85=C2=A1=C3=85=C2=B3=C3=85=C2=AB=C3=85=C2=BE?=

for $str2, base64 encoding:
=?UTF-8?B?w4TChcOEwo3DhMKZw4TCl8OEwq/DhcKhw4XCs8OFwqvDhcK+?=


-- 
Edit bug report at http://bugs.php.net/?id=43345&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43345&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43345&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43345&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43345&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43345&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43345&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43345&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43345&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43345&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43345&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43345&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43345&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43345&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43345&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43345&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43345&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43345&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43345&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43345&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43345&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43345&r=mysqlcfg

Reply via email to