Thanks for your reply bradgrafelman.
bradgrafelman;10918469 wrote:How do you know? Can you show us where you set the charset on the HTML document?
Because when I echo the input, it displays fine (?). I've also tried passing the value to mysql_query with utf8_encode($name) - but that doesn't help either.
[man]mysql_query/man neither adds nor subtracts characters to strings passed to it. It simply accepts the string and passes it along to the SQL server. Now, if there is an encoding problem either between the HTML form and the PHP script, or between the PHP script and the connection to the MySQL server, then that is no fault of mysql_query().
I too am sure it's an encoding problem. Byt where?
Another test case:
In another form, I add the label "Fióres Häßelberg" and submit this.
In the database it's stored as written.
On another page, typing 'Fi' in a text box with autosuggest, it displays "Fióres Häßelberg".
The Autosuggest uses the following code to retrieve results:
public function getSearchResultForLabels($input)
{
$sql = "SELECT id,name
FROM sl_label
WHERE name LIKE '$input%'
ORDER BY name ASC";
$this->query($sql);
return $this->query_result;
}
This demonstrates that I can store and retrieve names with special characters.
That's why I suggested trying the SET NAMES command as well as showing us how you're setting the correct charset on the HTML form.
I have tried that. But that really screws up the ouput. Characters like æ, ø, å, `, is shown as completely gibberish.