src/Mysqli/MysqliDriver.php
public function setUtf()
	{
		// If UTF is not supported return false immediately
		if (!$this->utf)
		{
			return false;
		}

		// Make sure we're connected to the server
		$this->connect();

		// Which charset should I use, plain utf8 or multibyte utf8mb4?
		$charset = $this->utf8mb4 && $this->options['utf8mb4'] ? 'utf8mb4' : 'utf8';

		$result = @$this->connection->set_charset($charset);

		/*
		 * If I could not set the utf8mb4 charset then the server doesn't support utf8mb4 despite claiming otherwise. This happens on old MySQL
		 * server versions (less than 5.5.3) using the mysqlnd PHP driver. Since mysqlnd masks the server version and reports only its own we
		 * can not be sure if the server actually does support UTF-8 Multibyte (i.e. it's MySQL 5.5.3 or later). Since the utf8mb4 charset is
		 * undefined in this case we catch the error and determine that utf8mb4 is not supported!
		 */
		if (!$result && $this->utf8mb4 && $this->options['utf8mb4'])
		{
			$this->utf8mb4 = false;
			$result        = @$this->connection->set_charset('utf8');
		}

		return $result;
	}
public function setUtf()
	{
		// If UTF is not supported return false immediately
		if (!$this->utf)
		{
			return false;
		}

		// Make sure we're connected to the server
		$this->connect();

		// Which charset should I use, plain utf8 or multibyte utf8mb4?
		$charset = $this->utf8mb4 && $this->options['utf8mb4'] ? 'utf8mb4' : 'utf8';

		$result = @$this->connection->set_charset($charset);

		/*
		 * If I could not set the utf8mb4 charset then the server doesn't support utf8mb4 despite claiming otherwise. This happens on old MySQL
		 * server versions (less than 5.5.3) using the mysqlnd PHP driver. Since mysqlnd masks the server version and reports only its own we
		 * can not be sure if the server actually does support UTF-8 Multibyte (i.e. it's MySQL 5.5.3 or later). Since the utf8mb4 charset is
		 * undefined in this case we catch the error and determine that utf8mb4 is not supported!
		 */
		if (!$result && $this->utf8mb4 && $this->options['utf8mb4'])
		{
			$this->utf8mb4 = false;
			$result        = @$this->connection->set_charset('utf8');
		}

		return $result;
	}
public function setUtf ( ) { // If UTF is not supported return false immediately if ( ! $ this -> utf ) { return false ; } // Make sure we're connected to the server $ this -> connect ( ) ; // Which charset should I use, plain utf8 or multibyte utf8mb4? $ charset = $ this -> utf8mb4 && $ this -> options [ 'utf8mb4' ] ? 'utf8mb4' : 'utf8' ; $ result = @ $ this -> connection -> set_charset ( $ charset ) ; /*
		 * If I could not set the utf8mb4 charset then the server doesn't support utf8mb4 despite claiming otherwise. This happens on old MySQL
		 * server versions (less than 5.5.3) using the mysqlnd PHP driver. Since mysqlnd masks the server version and reports only its own we
		 * can not be sure if the server actually does support UTF-8 Multibyte (i.e. it's MySQL 5.5.3 or later). Since the utf8mb4 charset is
		 * undefined in this case we catch the error and determine that utf8mb4 is not supported!
		 */ if ( ! $ result && $ this -> utf8mb4 && $ this -> options [ 'utf8mb4' ] ) { $ this -> utf8mb4 = false ; $ result = @ $ this -> connection -> set_charset ( 'utf8' ) ; } return $ result ; }
Set the connection to use UTF-8 character encoding.

@return  boolean  True on success.

@since   1.0
Set the connection to use UTF - 8 character encoding .