Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get a common Encoding between C#.NET, PHP and MySQL?
    primarykey
    data
    text
    <p>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 <code>äöü</code> or some other stuff (I´m urlencoding it, so there are also <code>&amp;%$/")=!</code> contained in the string) it will be stored in the database as <code>È└/</code> or something like that. So it´s definely an encoding-problem. How can I solve it?</p> <p><strong>EDIT:</strong><br/> I´m using these pieces of code:<br/> C#:</p> <pre><code>WebClient.DownloadString(apiString + "sendMessage.php?user=" + user + "&amp;message=" + message); </code></pre> <p>PHP:<br/></p> <pre><code>$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'] . "');"); </code></pre> <p>When I call the values again:</p> <p>PHP:</p> <pre><code>$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-&gt;username == "system") { echo "[" . $row-&gt;message . "]"; } else { if($row-&gt;username == "command") { echo "*".$row-&gt;message; } else { echo /* $row-&gt;time . " " . */$row-&gt;username . ": " . $row-&gt;message; } } } </code></pre> <p>C#:</p> <pre><code>WebClient.DownloadString(apiString + "getMessages.php"); </code></pre> <p>The MySQL collation type is now changed to utf8_bin and it still does not work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload