I have a C#-Application which sends data to a php and the php stores the data into a mysql-database. And if I have an äöü or some other stuff (I´m urlencoding it, so there are also &%$/")=! contained in the string) it will be stored in the database as È└/ or something like that. So it´s definely an encoding-problem. How can I solve it?
EDIT:
I´m using these pieces of code:
C#:
WebClient.DownloadString(apiString + "sendMessage.php?user=" + user + "&message=" + message);
PHP:
$verbindung = mysql_connect("nightking.org", "username", "password");
mysql_select_db("apidb");
$ergebnis = mysql_query("INSERT INTO `apidb`.`tm_chatdata` (`username` ,`time` ,`message`) VALUES ('" . $_GET['message'] . "',CURRENT_TIMESTAMP , '" . $_GET['user'] . "');");
When I call the values again:
PHP:
$verbindung = mysql_connect("nightking.org", "username", "password");
mysql_select_db("apidb");
$ergebnis = mysql_query("(SELECT * FROM `tm_chatdata` ORDER BY time DESC LIMIT 38)ORDER BY time ASC;");
$firstOne = true;
while($row = mysql_fetch_object($ergebnis))
{
if($firstOne)
$firstOne = false;
else
{
echo "\r\n";
}
if($row->username == "system")
{
echo "[" . $row->message . "]";
}
else
{
if($row->username == "command")
{
echo "*".$row->message;
}
else
{
echo /* $row->time . " " . */$row->username . ": " . $row->message;
}
}
}
C#:
WebClient.DownloadString(apiString + "getMessages.php");
The MySQL collation type is now changed to utf8_bin and it still does not work.