I have a database, utf8_general_ci, and I have manually inserted the values into. Between those values, I have also special characters like à
, è
and so on. Now what I'm trying to do, is to print those values through PHP. My page has already <meta charset="utf-8">
, also $mysqli->real_escape_string
but I still get a ? instead of that characters. Is not a font problem, if I manually echo "à";
it works, but the data from DB doesn't.
Asked
Active
Viewed 13 times
1

Aram Grigoryan
- 740
- 1
- 6
- 24

alexcr
- 171
- 1
- 12
-
`real_escape_string` is not for outputting. Did you set the character set of the `mysqli` connection? – user3783243 Jun 26 '18 at 20:04
-
you mean mysqli_query("set names 'utf8'"); than yes – alexcr Jun 26 '18 at 20:21
-
`mysqli_query("set names 'utf8'")` would do nothing, you need the link there. Please add code to the question. – user3783243 Jun 26 '18 at 20:22
-
1solved it with $con->set_charset('utf8'); – alexcr Jun 26 '18 at 20:27
-
If you were using the `real_escape_string` to prevent XSS injections you should look at `htmlspecialchars`. That is for outputting to a browser. – user3783243 Jun 26 '18 at 20:29