I tried to switch all my content in the database to UTF8 because some characters weren't showing up. I switched everything in the database, all column collations, tables, etc to utf8_general_ci. I made sure my header.php specifies the charset as UTF8:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
I added
AddDefaultCharset UTF-8
to .htaccess. I made a php.ini file and put
default_charset = "utf-8"
mbstring.internal_encoding=utf-8
mbstring.http_output=UTF-8
mbstring.encoding_translation=On
mbstring.func_overload=6
in it. I also exported everything in the database as utf8, dropped everything and imported. In the database itself, the characters show up correctly. Everything looks great. But on the website, in both local and live environments and on FF, Chrome, and IE, there are only ?????. The last thing I did was go into my config.php and edit the db stuff directly.
<?php
ob_start();
if(!isset($_SESSION))
{
session_start();
}
//set timezone
date_default_timezone_set('America/Denver');
//database credentials
define('DBHOST','localhost');
define('DBUSER','root');
define('DBPASS','');
define('DBNAME','dbname');
define('CHARSET', 'utf8');
//application address
define('DIR','http://websiteurlcom');
define('SITEEMAIL','email@whatever.com');
try {
//create PDO connection
$db = new PDO("mysql:host=".DBHOST.";dbname=".DBNAME, DBUSER, DBPASS.";charset=".CHARSET);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
//show error
echo '<p class="bg-danger">'.$e->getMessage().'</p>';
exit;
}
//include the user class, pass in the database connection
include('classes/user.php');
$user = new User($db);
?>
I also ran the query:
SET NAMES utf8
directly in the database. I checked the encoding of both Notepad++ (utf8 without BOM) and Brackets. None of that has worked. I can't figure out what's wrong.