Johnny000
Johnny000

Reputation: 2104

mysql utf8 uni charset

I have some german datasets im my Database. On those fields I use utf8 uni, my php and apache is also running on utf8 uni. I don't know why but mysql saves the data in this fields like that if there is some german special char

Mit Gummizug für den perfekten

I don't want those "ü" what do I need to change to show these special chars correctly?

Upvotes: 1

Views: 235

Answers (2)

martinstoeckli
martinstoeckli

Reputation: 24071

Tell the connection object to deliver UTF-8, before making queries and inserts:

// tells the mysqli connection to deliver UTF-8 encoded strings.
$db = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);
$db->set_charset('utf8');

For other types of mysql connections have a look here.

Upvotes: 0

jstephenson
jstephenson

Reputation: 2180

Have you opened the connection with mySQL in UTF8 mode? If not, I suspect this is your problem.

Assuming you're using PDO, you'd do this by appending 'charset=utf8' to your connection string.

Upvotes: 2

Related Questions