Wednesday, 15 August 2012

php - Charset is set to UTF-8, but mysqli reports NOT utf8 -



php - Charset is set to UTF-8, but mysqli reports NOT utf8 -

this question has reply here:

utf-8 way through 16 answers

all danish characters (æøå etc.) replaced questionmarks on page. it's classic

everything (host, database, table) set utf8_unicode_ci in phpmyadmin

every column in table set utf8_unicode_ci

my webpage file made , saved in utf-8, , has php header + meta:

header('content-type: text/html; charset=utf-8'); <meta http-equiv="content-type" content="text/html; charset=utf-8" />

then run mysql charset test in php:

var_dump($conn->get_charset());

the result?

["charset"]=> string(6) "latin1" ["collation"]=> string(17) "latin1_swedish_ci".. (trimmed vardump)

why? , how can prepare this?

you have execute query after connecting mysql:

set names 'utf8'

php mysql utf-8 mysqli character-encoding

No comments:

Post a Comment