|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-07 14:15 UTC] hiroaki dot kawai at gmail dot com
Description:
------------
iconv_mime_encode fails Q-encoding when encoding non-ascii chars,
which case is very common. This problem does not happen if line-length
is long enough to hold the encoded string in a single line.
The code use unsigned int to capture expected byte. In Q-encoding, the
value is goes to negative value (at iconv.c line 1295), and fails
separating the value into multiple lines.
Patch as following:
===============================
--- iconv.c.orig 2008-12-31 20:17:49.000000000 +0900
+++ iconv.c 2010-02-07 11:01:54.436000000 +0900
@@ -1217,7 +1217,7 @@
prev_in_left = ini_in_left = in_left;
ini_in_p = in_p;
- for (out_size = char_cnt; out_size >
0;) {
+ for (out_size = (char_cnt-2)/3;
out_size > 0;) {
size_t prev_out_left;
nbytes_required = 0;
Reproduce code:
---------------
<?php
ini_set('error_reporting',E_ALL);
echo iconv_mime_encode('a',"\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88\xE3\x83\x86\xE3\x82\xB9\xE3\x83\x88",array('output-charset'=>'UTF-8','input-charset'=>'UTF-8','scheme'=>'Q','line-length'=>30));
Expected result:
----------------
a: =?UTF-8?Q?=E3=83=86?=
=?UTF-8?Q?=E3=82=B9?=
=?UTF-8?Q?=E3=83=88?=
=?UTF-8?Q?=E3=83=86?=
=?UTF-8?Q?=E3=82=B9?=
=?UTF-8?Q?=E3=83=88?=
Actual result:
--------------
Notice: iconv_mime_encode(): Unknown error (7) in /home/hawk/hoge.php on
line 3
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
My name is Janifer modric and I base in USA...“My life is back!!! After 14 years of Broken marriage, my husband left me and our two twins . I felt like my life was about to end i almost commited suicide, i was emotionally down for a very long time. Thanks to a spell caster called Dr Zula which i met online. On one faithful day, as I was browsing through the internet, I was searching for a good spell caster that can solve my problems. I came across alot of testimonies about this particular spell caster. Some people testified that he brought their Ex lover back, some testified that he restores womb,cure cancer,and other sickness, some testified that he can cast a spell to stop divorce and so on. i also come across one particular testimony,it was about a woman called sonia,she testified about how Dr Zula brought back her Ex lover in less than 7 days and reverse the effect of their little boys cancer, and at the end of her testimony she dropped Dr. Zula 's e-mail address. After reading all these,I decided to give Dr Zula a try. I contacted him via email and explained my problem to him. In just 3 days, my husband came back to me. We solved our issues, and we are evenhappier than before. Dr Zula is really a gifted man and i will not stop publishing him because he is a wonderful man... If you have a problem and you are looking for a real and genuine spell caster to solve all your problems for you. Try Dr Zula anytime, he might be the answer to your problems. Here's his contact:{odumagadaspiritualtemple@hotmail.com}.or by phone :+2348155983287 Thank you Dr Zula