ID:               48289
 User updated by:  astax dot t at gmail dot com
 Reported By:      astax dot t at gmail dot com
 Status:           Open
 Bug Type:         ICONV related
 Operating System: *
 PHP Version:      5.*, 6
 New Comment:

I'd like to test the patch described in #50954. Is it included into any
PHP build already? Sorry, I don't feel like compiling PHP from sources.


Here is one more reproduce code:

$str =
base64_decode("1Ojr6ODrICLH4O/g5O3uLdHo4ejw8ero6SIgzsDOICLR7uHo7eHg7eoiIPDg5CDv8OXk8fLg4ujy/A==");

$par = array(
        'scheme' => 'Q',
        'input-charset' => 'CP1251',
        'output-charset' => 'CP1251',
        'line-length' => 74,
);

$res = iconv_mime_encode('Subject', $str, $par);

$res = iconv_mime_decode($res, ICONV_MIME_DECODE_CONTINUE_ON_ERROR,
'CP1251');
echo 'Result: Length='.strlen($res)."  ".$res."\n";
$expected = "Subject: ".$str;
echo 'Expected: Length='.strlen($expected)."  ".$expected."\n";



It says result length is 74 chars and expected is 67.


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

[2010-02-07 17:38:40] j...@php.net

See also bug #50954 (has a patch too)

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

[2009-10-13 08:22:52] rosier at interstroom dot nl

// PHP version: 5.3.0
echo 'PHP version: ' . phpversion();

$subject =
base64_decode('VEVTVCDigJMg0KMg0L3QsNGBINC10YHRgtGMINGC0L4sINGH0YLQviDQktCw0Lwg0L3Rg9C20L3QviAtIFRFU1Q=');

$preferences = array(
    'line-length' => 500,
    'input-charset' => 'UTF-8',
    'output-charset' => 'UTF-8',
    'scheme' => 'Q'
);
$result = iconv_mime_encode('Subject', $subject, $preferences);
// OK: $result = string
var_dump($result);

$preferences = array(
    'line-length' => 76,
    'input-charset' => 'UTF-8',
    'output-charset' => 'UTF-8',
    'scheme' => 'Q'
);
$result = iconv_mime_encode('Subject', $subject, $preferences);
// WRONG: $result = FALSE
var_dump($result);

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

[2009-07-10 03:02:15] astax dot t at gmail dot com

dypa at bk dot ru: Please make sure you use Windows-1251 charset
everywhere when you copy and paste test content. Everywhere means in
browser and in text editor.
In your case I think iconv fails because you pasted the text in
ISO-8859-1 charset.

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

[2009-07-09 19:13:25] support at canada-brand dot com

http://www.canada-brand.com

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

[2009-05-16 17:45:48] dypa at bk dot ru

all tests give error:
Notice: iconv_mime_encode() [function.iconv-mime-encode]: Unknown error
(7) in /var/www/def.php on line 12

u...@localhost:/rss$ php -v
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23
2009 14:35:05) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

iconv
iconv support   enabled 
iconv implementation    glibc 
iconv library version   2.9

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/48289

-- 
Edit this bug report at http://bugs.php.net/?id=48289&edit=1

Reply via email to