Charset in PHP with MySQL [duplicate]

1

Following: The header of my page is configured like this:

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

I configured the connection to MySQL like this:

mysqli_set_charset($dbc, 'utf8');

In my MySQL database a is set to InnoDB and the collation is "utf8_general_ci" with UTF8 charset. The only problem that is making me sleep is I have an application developed in VB-6 that when saved a name in uppercase with accent, eg: JOHN, normal save, but if I use the web application (PHP / MySQL) it saves like this: John. Does anyone know what it can be, and how can I solve this tiny detail ?! See the image:

    
asked by anonymous 07.01.2017 / 23:10

1 answer

0

Solved! Before my insert I get $_POST['ap-nome'] and put it as an uppercase with the strtoupper() function of PHP. In the documentation it says that the characters of the alphabet is determined by the current location. On the same page you have another suggestion of PHP's own function called mb_strtoupper() , with it you can configure the charset. It looks like this:

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

Tested, approved and functional.

    
08.01.2017 / 02:22