|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-06-06 12:38 UTC] alix dot axel at gmail dot com
-PHP Version: 5.2.13
+PHP Version: 5.3.1
[2010-06-06 12:38 UTC] alix dot axel at gmail dot com
[2010-10-22 15:46 UTC] kalle@php.net
-Package: ICONV related
+Package: Documentation problem
[2010-10-24 16:02 UTC] kalle@php.net
[2010-10-24 16:02 UTC] kalle@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: kalle
[2010-10-24 16:02 UTC] kalle@php.net
[2020-02-07 06:08 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 17:00:02 2026 UTC |
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?=