Doc #52006 [Opn->Csd]: Misleading Documentation on iconv_mime_encode()

From: Date: Sun, 24 Oct 2010 14:02:54 +0000
Subject: Doc #52006 [Opn->Csd]: Misleading Documentation on iconv_mime_encode()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5397@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52006&edit=1 ID: 52006 Updated by: kalle@php.net Reported by: alix dot axel at gmail dot com Summary: Misleading Documentation on iconv_mime_encode() -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: Windows 7 PHP Version: 5.3.1 -Assigned To: +Assigned To: kalle Block user comment: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2010-10-24 16:02:49] kalle@php.net Automatic comment from SVN on behalf of kalle Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=304699 Log: Fixed bug #52006 (Misleading Documentation on iconv_mime_encode()) ------------------------------------------------------------------------ [2010-06-06 12:38:29] alix dot axel at gmail dot com I should add that my source file is encoded as UTF-8 without BOM, and all my 'iconv.*_encoding' configuration values are set to 'ISO-8859-1'. ------------------------------------------------------------------------ [2010-06-06 12:34:10] alix dot axel at gmail dot com Description: ------------ I'm using iconv (libiconv) 1.13 with PHP 5.3.1 running under Windows 7 and I've noticed two inconsistencies in calls to iconv_mime_encode() and the documentation page for that function, I'm not sure if this is due to errors on the documentations or if the function is buggy: 1) The documentation page states that if 'output-charset' is not passed with the 'preferences' array it will use the value of 'input-charset'. I was not able to reproduce this, 'output-charset' seems to default to 'iconv.internal_encoding', even when 'input-charset' is set in the 'preferences' argument. 2) The first example in the documentation page ($preferences["scheme"] = "Q") doesn't yield the output that the related comment suggests, spaces are encoded as '=20' and not '_'. Test script: --------------- <?php // 1st inconsistency echo iconv_get_encoding('internal_encoding') . "\n"; echo iconv_mime_encode('Subject', 'Prüfung Prüfung', array('scheme' => 'Q', 'input-charset' => 'UTF-8')) . "\n"; echo iconv_mime_encode('Subject', 'Prüfung Prüfung', array('scheme' => 'Q', 'input-charset' => 'UTF-8', 'output-charset' => 'UTF-8')) . "\n"; // 2nd inconsistency $preferences = array( "scheme" => "Q", "input-charset" => "ISO-8859-1", "output-charset" => "UTF-8", "line-length" => 76, "line-break-chars" => "\n", ); echo iconv_mime_encode("Subject", "Prüfung Prüfung", $preferences) . "\n"; ?> Expected result: ---------------- ISO-8859-1 Subject: =?UTF-8?Q?Pr=C3=BCfung=20Pr=C3=BCfung?= Subject: =?UTF-8?Q?Pr=C3=BCfung=20Pr=C3=BCfung?= Subject: =?UTF-8?Q?Pr=C3=BCfung_Pr=C3=BCfung?= Actual result: -------------- ISO-8859-1 Subject: =?ISO-8859-1?Q?Pr=FCfung=20Pr=FCfung?= Subject: =?UTF-8?Q?Pr=C3=BCfung=20Pr=C3=BCfung?= Subject: =?UTF-8?Q?Pr=C3=83=C2=BCfung=20Pr=C3=83=C2=BCfung?= ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52006&edit=1

« previous php.doc.bugs (#5397) next »