0
I use utf-8
at the time of insertion of the field nome
in PHP, thus:
$nome = utf8_encode(strtolower($nome));
When checking how the insert
Before inserting, the word is correct, but when I access the bank after insertion, the word is disfigured. I’d like to know what I’m doing wrong, because I’ve tried to change in the bank to utf-8
and yet you insert it wrong.
Thank you in advance!
In connection with Mysql you have set to use UTF8?
– Don't Panic
In your case change the constant
MB_CASE_UPPER
forMB_CASE_LOWER
.strtolower()
does not work with characters with more than one byte (usually accents and others). If Encode is right you can also remove theutf8_encode()
– rray
MB_CASE_LOWER returns error: Fatal error: Call to Undefined Function MB_CASE_LOWER(). And I didn’t understand you, if the Ncode was right, remove the Ncode?
– R.Gasparin
$nome = mb_convert_case($nome, MB_CASE_LOWER);
didn’t work? It was wrong for the bank yet?– rray
Can’t the connection be the problem? I use utf8 in my projects:
$con = new PDO('mysql:host=127.0.0.1;dbname=test', 'root','123456',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
– Don't Panic
Provides the code you use for connection to the bank and checks if your files are in utf8
– sNniffer
SET NAMES utf8 should work
– Emerson Vieira
I will test all this and return here with the result
– R.Gasparin
One of the first problems I notice in the code is utf8_encode. This is a compatibility function with external systems, if the DB and the output are in the same pattern, it makes no sense. More than that: strtolower is not a multibyte function. It should be mb_.... (unless you are ACTUALLY converting patterns)
– Bacco