So I saved some data in a mysql database and its stored there with "umlauts".
When I'm speaking of umlauts I mean these German letters: ö, ä, ü and their capitalized pendants.
So now I execute a query via PHP, something like this:
$query = "SELECT * FROM tcms_references WHERE id =".$row->id;
$erg = mysql_query($query);
$rowt = mysql_fetch_object($erg);
foreach($row as $x) {
echo $x
}
Now, there is no German word like "Baumfällung" saved in my database. The PHP query is executed and presented on the screen as "Baumfällung".
My question: Where can I set UFT-8 as a Standart in PHP? Is there any function or something?
Answer
You need to set mysql connection to utf8
mysql_query ('SET NAMES UTF8;');
mysql_query ('SET COLLATION_CONNECTION=utf8_general_ci;');
mysql_client_encoding($conn);// where $conn is your connection
save page as utf8 and also put this in head of page
No comments:
Post a Comment