Doc #68573 [Opn->Csd]: No mention that fetch_fields()'s output depends on client charset
| From: | philip@php.net | Date: | Thu, 03 Sep 2015 23:31:09 +0000 |
| Subject: | Doc #68573 [Opn->Csd]: No mention that fetch_fields()'s output depends on client charset | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12718@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68573&edit=1
ID: 68573
Updated by: philip@php.net
Reported by: sebastianzartner at gmail dot com
Summary: No mention that fetch_fields()'s output depends on
client charset
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: MySQLi related
PHP Version: 5.6.3
-Assigned To:
+Assigned To: philip
Block user comment: N
Private report: N
New Comment:
Thank you for the detailed bug report, it is much appreciated. A fix has been committed to SVN and
it will show up online shortly. The example was expanded to include the 'length' and use
two different character sets (latin1 and utf8), and also the length description was expanded to
explain bytes vs characters using utf8 and latin1 as examples. Again, thank you for the bug report.
Previous Comments:
------------------------------------------------------------------------
[2014-12-09 09:21:17] sebastianzartner at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli-result.fetch-fields
---
The return values for mysqli_result::fetch_fields are vaguely defined.
There is no mention that 'length' and 'charsetnr' depend on the default client
character set, which can be changed via mysqli::set_charset.
This leads to great confusions[1] as people expect 'length' to reflect the length they set
for the column.
E.g. a column defined as varchar(10) will result in 'length' being 30 and
'charsetnr' being 33 if the client charset is set to 'utf8'.
[1] http://stackoverflow.com/q/10430406/432681
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68573&edit=1