Req #54605 [NEW]: promote the usage of mysql_set_charset

From: Date: Tue, 26 Apr 2011 09:26:16 +0000
Subject: Req #54605 [NEW]: promote the usage of mysql_set_charset
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6284@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Feature/Change Request Bug description:promote the usage of mysql_set_charset Description: ------------ I noticed that nobody from my fellow php developers are aware that they should use mysql_set_charset over mysql_query('SET NAMES utf-8'); I wanted to tell them to RTFM, but currently, the only place that we talk about mysql_set_charset is on the documentation page of mysql_client_encoding and the documentation page of that function, which tells that: "This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended." but doesn't mention why is that. I would propose adding something like this to the documentation either as a note or in the description: "As mysql_real_escape_string takes into account the current character set of the connection, you should only change client encoding through mysql_set_charset, not via mysql_query('SET NAMES ...'); or mysql_real_escape_string cannot guarantee that the string is properly escaped." maybe we should link http://shiflett.org/blog/2006/jan/addslashes-versus-mysql- real-escape-string also. I would also propose that we link mysql_set_charset in the documentation of mysql_real_escape_string, and adding a mysql_set_charset into every mysql example. the same should be done to the mysqli documentation also -- Edit bug report at http://bugs.php.net/bug.php?id=54605&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54605&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54605&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54605&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54605&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54605&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54605&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54605&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54605&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54605&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54605&r=support Expected behavior: http://bugs.php.net/fix.php?id=54605&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54605&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54605&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54605&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54605&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54605&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54605&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54605&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54605&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54605&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54605&r=mysqlcfg

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