im not new in php coding and have a problem. I need insert data to sql (czech language encoding).
I wanna input this string: +ěščřžýáíéůú My DB output is: +ì¹èø¾ýáíéùú
So, im trying this solutions:
1) My config.php has this one:
header('Content-Type: text/html; charset=utf-8');
ini_set("default_charset", 'utf-8');
2) On top of the page is this meta-tags:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8" />
3) When im connecting into db, im using:
@define("DB_Connect_Charset", "utf8");
$dsn = 'mysql:dbname='.DB_Connect_Database.';host='.DB_Connect_Hostname.';charset='.DB_Connect_Charset;
+
$this->pdo = new PDO($dsn, DB_Connect_Username, DB_Connect_Password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES ".DB_Connect_Charset));
Im trying some php functions like: iconv OR mb_convert_encode()
Database has utf8_czech_ci
coding, when im trying to change it into windows-1251 or latin.. it doesnt help.
I spend a lot of time on stackoverflow and cannot find a solution about this problem, some problems will be deleted with SET NAMES UTF8.
Problem must be in part when im sending data to SQL, because if im put data manually into sql, im fetching it correctly.
Thank you for your time and help. Have a nice day!