0

I can see query results but I also see � character with some characters like "Á".

Basic connection is like this:

$mysqli = new mysqli(server, user, pass, db);
mysqli_set_charset($mysqli, 'utf8');

I also tried with:

$mysqli->query("SET NAMES 'utf8'");
$mysqli->set_charset("utf8");
mysql_query("SET NAMES 'utf8'");

But characters are still watching.

Query

function connection($mysqli) {

    mysql_query("SET NAMES 'utf8'");

    if ( ! $link = mysqli_connect("localhost", "user", "pass") ) {
        echo ("Error");
        return false;
    }
    if ( ! mysqli_select_db($link, "db") ) {
        echo ("Error");
        return false;
    }
    if ( ! $consulta = mysqli_query($link, $mysqli) ) {
        echo ("Error");
        return false;
    }
    return $consulta;
}

All files are saved with UTF8, VAR columns in DB are with UTT8 too.

What or where is the problem?

Thank you!

  • [Don’t use `SET NAMES` for setting the character encoding.](http://stackoverflow.com/q/5288953/53114) – Gumbo Apr 06 '14 at 12:17

1 Answers1

0

Maybe your php file is saved as an ANSI doc, try with UTF8 without BOM. Also try to declare the charset UTF8 on your output file.

Hope it help

devseo
  • 1,182
  • 1
  • 13
  • 26
  • All files are saved with UTF8 without BOM =S – daniclemente Apr 06 '14 at 12:29
  • FYI, with mysql_connect I haven't any problem: $sql = mysql_connect(server,user,pass); mysql_query("SET NAMES 'utf8'"); But, now, I have changed to mysqli and I have this problem with characters – daniclemente Apr 06 '14 at 12:37