Charset in PHP with Mysql

Asked

Viewed 265 times

1

following: My page header is configured like this:

 header('Content-Type: text/html; charset=UTF-8');

Set up the Mysql connection like this:

mysqli_set_charset($dbc, 'utf8');

In my Mysql database a is configured with Innodb and the collation is "utf8_general_ci" with charset UTF8. The only problem that is keeping me awake is I have an application developed in VB-6 that when I save a name in upper case with accent, ex: JOÃO, saves normal, but if I use the web application (PHP/Mysql) it saves like this: João. Someone knows what it can be, and how can I solve this tiny detail?! See the image:inserir a descrição da imagem aqui

  • Could you explain it better? "When you use the web application"? Could you put the snippet of php code that makes this Insert?

1 answer

0

Solved! Before my Insert I get the $_POST['ap-nome'] and put as uppercase with the function strtoupper() PHP. In the documentation it says that the alphabet characters are determined by the current location. On the same page there is another PHP function suggestion called mb_strtoupper(), with it it is possible to configure the charset. It was like this:

$apNome = mb_strtoupper($_POST['ap-nome'],'UTF-8');

Tested, approved and functional.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.