Doc #52006 [NEW]: Misleading Documentation on iconv_mime_encode()

From: Date: Sun, 06 Jun 2010 10:34:11 +0000
Subject: Doc #52006 [NEW]: Misleading Documentation on iconv_mime_encode()
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4506@lists.php.net to get a copy of this message
From: Operating system: Windows 7 PHP version: 5.2.13 Package: ICONV related Bug Type: Documentation Problem Bug description:Misleading Documentation on iconv_mime_encode() 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 bug report at http://bugs.php.net/bug.php?id=52006&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52006&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52006&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52006&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52006&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52006&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52006&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52006&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52006&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52006&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52006&r=support Expected behavior: http://bugs.php.net/fix.php?id=52006&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52006&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52006&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52006&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52006&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52006&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52006&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52006&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52006&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52006&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52006&r=mysqlcfg

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