How to set the default character .
Permalink 1 user found helpful
Where can i set the default character,when connection to the database.
There are a few different settings you can add to your config/site.php file for this:
Also make sure your mysql database is using the same collation and also that your database tables are using the same character set (you can set those via phpMyAdmin).
Also make sure your mysql database is using the same collation and also that your database tables are using the same character set (you can set those via phpMyAdmin).
define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', 'utf8_general_ci');
if open define('DB_COLLATE', 'utf8_general_ci') will get this error:
Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE 'utf8_general_ci'' at line 1] in EXECUTE("SET CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'")
//define('DB_COLLATE', 'utf8_general_ci');
if open define('DB_COLLATE', 'utf8_general_ci') will get this error:
Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE 'utf8_general_ci'' at line 1] in EXECUTE("SET CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'")
Actually when I click on tags,if it contain chinese word the following error will be reported
error log:Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'] in EXECUTE("select p1.cID, pt.ctHandle from Pages p1 left join Pages p2 on (p1.cPointerID = p2.cID) left join PageTypes pt on (pt.ctID = (if (p2.cID is null, p1.ctID, p2.ctID))) left join PagePaths on (PagePaths.cID = p1.cID and PagePaths.ppIsCanonical = 1) left join PageSearchIndex psi on (psi.cID = if(p2.cID is null, p1.cID, p2.cID)) inner join CollectionVersions cv on (cv.cID = if(p2.cID is null, p1.cID, p2.cID) and cvID = (select cvID from CollectionVersions where cvIsApproved = 1 and cID = cv.cID)) inner join Collections c on (c.cID = if(p2.cID is null, p1.cID, p2.cID)) left join CollectionSearchIndexAttributes on (CollectionSearchIndexAttributes.cID = if (p2.cID is null, p1.cID, p2.cID)) where 1=1 and (REPLACE(CollectionSearchIndexAttributes.ak_tags, "\n", "||") like '%||插件||%' ) and cvIsApproved = '1' and (p1.cIsTemplate = 0 or p2.cIsTemplate = 0) and (p1.cID not in (5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55) or p2.cID not in (5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55)) order by cDatePublic desc limit 0,20 ")
error log:Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'] in EXECUTE("select p1.cID, pt.ctHandle from Pages p1 left join Pages p2 on (p1.cPointerID = p2.cID) left join PageTypes pt on (pt.ctID = (if (p2.cID is null, p1.ctID, p2.ctID))) left join PagePaths on (PagePaths.cID = p1.cID and PagePaths.ppIsCanonical = 1) left join PageSearchIndex psi on (psi.cID = if(p2.cID is null, p1.cID, p2.cID)) inner join CollectionVersions cv on (cv.cID = if(p2.cID is null, p1.cID, p2.cID) and cvID = (select cvID from CollectionVersions where cvIsApproved = 1 and cID = cv.cID)) inner join Collections c on (c.cID = if(p2.cID is null, p1.cID, p2.cID)) left join CollectionSearchIndexAttributes on (CollectionSearchIndexAttributes.cID = if (p2.cID is null, p1.cID, p2.cID)) where 1=1 and (REPLACE(CollectionSearchIndexAttributes.ak_tags, "\n", "||") like '%||插件||%' ) and cvIsApproved = '1' and (p1.cIsTemplate = 0 or p2.cIsTemplate = 0) and (p1.cID not in (5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55) or p2.cID not in (5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55)) order by cDatePublic desc limit 0,20 ")
It sounds like you didn't change the charset and collation of your database. You must do this as well (in PhpMyAdmin, not in the concrete5 code).
I have solve this problem, beacouse some database table the property charset is not utf8.
Well you could use PHP's
They can also be set in PHP's php.ini and MySQL's my.cnf
- Josh