1
Look I’m saving data on SGBD Postgresql, only that the data (NAME, CITY, STREET), I am saving in capital to facilitate when searching.
He’s saving normal, the problem is that when I save a word in capital letters and accent, the Postgresql turns the letter into a lower case.
$nome = strtoupper($cliente->getNome());
$cpf = $cliente->getCpf();
$endereco = $cliente->getEndereco();
$cidade = strtoupper($endereco->getCidade());
$rua = strtoupper($endereco->getRua());
$numero = $endereco->getNumero();
$telefones = $cliente->getTelefones();
$telefone1 = $telefones[0];
$telefone2 = $telefones[1];
$valorArmazenar = $this->conexao->prepare("INSERT INTO cliente(nome_cliente,cidade, rua, numero, telefone1, telefone2, cpf) VALUES(:nome,:cidade,:rua,:numero,:telefone1,:telefone2, :cpf)");
$valorArmazenar->bindValue(":nome", $nome);
$valorArmazenar->bindValue(":cidade", $cidade);
$valorArmazenar->bindValue(":rua", $rua);
$valorArmazenar->bindValue(":numero",$numero);
$valorArmazenar->bindValue(":telefone1", $telefone1);
$valorArmazenar->bindValue(":telefone2", $telefone2);
$valorArmazenar->bindValue(":cpf", $cpf);
$valorArmazenar->execute();
See that the "A" of the word JOHN he left John "A" in tiny, and this makes it difficult at the time of my search by the record.
What is the CHARSET of the table?
– Rodrigo Jarouche
@Rodrigosartorijarouche the charset is utf-8
– Rodrigo Jacinto
I believe that
$valorArmazenar->bindValue(":nome", mb_substr($nome));
solves the problem ;)– ShutUpMagda
Rodrigo, Edson’s answer below will help you. Regardless of this, I suggest reading this article: (Don’t mind why the title seems offensive - the name is very important) http://local.joelonsoftware.com/wiki/O_M%C3%Adnimo_absoluto_que_todos_programmeres_de_software_they need,_Absolutely,Positivamente_de_Saber_Sobre_Unicode_e_Conjuntos_de_Caracteres(Apologies!)
– jsbueno