FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18746&edit=1

ID: 18746
Updated by: alan@akbkhome.com
Reported By: d dot travnikov at gmail dot com
Summary: Headers are decoded incorrectly
-Status: Open
+Status: Bogus
Type: Bug
Package: Mail_mimeDecode
Operating System: FreeBSD
Package Version: 1.5.5
PHP Version: 5.3.6
Roadmap Versions:
New Comment:

-Status: Open
+Status: Bogus
Thank you for taking the time to write to us, but this is not
a bug.

json_encode will only encode UTF8 - you need to convert the string to
unicode before outputing.


Previous Comments:
------------------------------------------------------------------------

[2011-08-20 17:40:43] karabas

Description:
------------
Let's say, the script should get the letter and return decoded
subject in JSON. If, for example, subject to be encoded in koi8-r,
then json_encode of decoded string will return null, because in
the decoded string contains illegal utf-8 codes.

Here is an example: =?koi8-r?B?4dPUxdLPycTZ?=


Test script:
---------------
<?php
require_once dirname(__FILE__) . '/mimeDecode.php';
$params['decode_headers'] = true;
$decoder = new Mail_mimeDecode('Subject: =?koi8-r?B?4dPUxdLPycTZ?=');
$struct = $decoder->decode($params);
print json_encode($struct->headers['subject']);


Expected result:
----------------
"\u0410\u0441\u0442\u0435\u0440\u043e\u0438\u0434\u044b"

Actual result:
--------------
null

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 22, '11 at 2:34a
activeAug 22, '11 at 2:34a
posts1
users1
websitepear.php.net

1 user in discussion

Alan: 1 post

People

Translate

site design / logo © 2022 Grokbase