我很高興你設法找到一個解決方案。 如果你不想擔心這麼多不同的字符集編碼,或者如果其他字符不起作用,這裏的替代方案: 我使用mysqli DB連接(和PHPV5)Form Post寫入/插入MySQl DB。
$Notes = $_POST['Notes']; //can be text input or textarea.
$Notes = str_replace('"', '"', $Notes); //double quotes for mailto: emails.
$von = array("ä","ö","ü","ß","Ä","Ö","Ü"," ","é"); //to correct double whitepaces as well
$zu = array("ä","ö","ü","ß","Ä","Ö","Ü"," ","é");
$Notes = str_replace($von, $zu, $Notes);
echo " Notes:".$Notes."<br>" ;
$Notes = mysqli_real_escape_string($link, $Notes); //for recommended mysqli DB connection.
//$Notes = mysql_real_escape_string($Notes); //for old deprecated mysql DB connection.
// mysqli_real_escape_string Escapes special characters in a string for use in an SQL statement
echo " Notes:".$Notes ; //ready for inserting
//Optinal:
$ charset = mysqli_character_set_name($ link); //只適用於mysqli數據庫連接 printf(「檢查你的字符集但不是必需的%s \ n」,$ charset);
「âââ¼Ã¢」基本上是UTF-8編碼數據「äöüß」誤解爲windows-1252編碼。究竟在哪裏(在哪個節目中,在哪些條件下)你看到「ââüÃÃ」? –
當前我正在運行xampp的本地主機環境中進行測試,並在Windows 8計算機上使用新的Chrome版本作爲瀏覽器。 – Lupo
你從哪裏收到它們?如果你看到它們「在你的數據庫中」,(phpmyadmin),你必須改變你把它放入的varchar字段的編碼。 – Alexander