<?PHP$mysqli=NewMysqli (' localhost ', ' root ', ' ', ' W '));if(Mysqli_connect_errno()){ printf(' Connect failed:%s\n ',Mysqli_connect_errno()); Exit();}$charset=$mysqli->character_set_name ();//Initial Character Set//latin1//sets the default character set to is used when sending data from and to the database s Erver. BOOLif($charset!== ' UTF8 ')$mysqli->set_charset (' UTF8 ');$charset=$mysqli->character_set_name ();//Current Character Set//utf8
<? PHP $mysqli new mysqli (' localhost ', ' root ', ' ', ' W '); if (Mysqli_connect_errno()) { printfmysqli_connect_errno()); Exit ();} if (! $mysqli->set_charset (' UTF8 '))echo$mysqli->error;
if(!$mysqli->set_charset (' 2utf8 '))Echo $mysqli->error;//Invalid characterset or character set not supportedif(!$mysqli->set_charset (' Utf-8 '))Echo $mysqli->error;//Invalid characterset or character set not supportedif(!$mysqli->set_charset (' UTF-8 '))Echo $mysqli->error;//Invalid characterset or character set not supported
Debug $mysqli->character_set_name ();