The problem:
An input of åäö in insert åäö in db. The file is in UTF-8 without BOM and comment in the table has utf8_general_ci coallition.
The code:
<?php
    if($_POST['comment']!=''){
            $comment=addcslashes($_POST['comment'], "\x00\n\r\'\x1a\x3c\x3e\x25");
            if($kommentar!=''){
                mysql_query("INSERT INTO comments (comment) VALUES ('$comment')") or die(mysql_error());
            }
        }
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="sv">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    <body>
    //Form
    </body>
Background:
Earlier I performed htmlentities on the $_POST['comment']; before inserting to db, and outputted directly, which worked fine. Then I wanted to go best practise and input raw data (just cleaning) and o htmlentities (or similar) on output. But then I discovered that e.g. åäö is not inputted as åäö but as åäö. Heeeelp :)
 
    