ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:setcharset

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
reference:setcharset [2015/07/23 20:46] – created mnewnhamv5:reference:connection:setcharset [2021/03/08 17:59] – Link to getCharSet() dregad
Line 1: Line 1:
-====== setCharSer ======+====== setCharSet ======
 ~~NOTOC~~ ~~NOTOC~~
-<WRAP important+<WRAP info
-Support for this command is limited to MySQL and Postgres databases+Support for this command is limited to MySQL and Postgres databases. As of ADOdb V5.21, you can use the [[v5:reference:connection:setconnectionparameter|setConnectionParameter()]] parameter with any database that supports character set configuration.
 </WRAP> </WRAP>
 <WRAP right box> <WRAP right box>
Line 14: Line 14:
 ===== Description ===== ===== Description =====
 The function ''setCharSet()'' set the **client side** character set to the specified set. The function returns true or false based on the success of command execution. The function ''setCharSet()'' set the **client side** character set to the specified set. The function returns true or false based on the success of command execution.
 +
 +See [[v5:reference:connection:getcharset|getCharSet()]].
 +
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 21: Line 24:
 ===== Workaround for setting server side character set on MySQL ===== ===== Workaround for setting server side character set on MySQL =====
 <code php> <code php>
-$SQL = "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");+$SQL = "SET  
 +    character_set_results    = 'utf8mb4', 
 +    character_set_client     = 'utf8mb4',  
 +    character_set_connection = 'utf8mb4', 
 +    character_set_database   = 'utf8mb4',  
 +    character_set_server     = 'utf8mb4'";
 $db->execute($SQL); $db->execute($SQL);
 </code> </code>
  
v5/reference/connection/setcharset.txt · Last modified: 2022/07/13 03:18 by mnewnham