Postgresql changes letter with accent [duplicate]

1

asked by anonymous 04.02.2017 / 23:24

2 answers

3

This is because strtoupper was not able to turn the accented letter to upper case, in this case use the mb_strtoupper instead.

$nome      = mb_strtoupper($cliente->getNome(), 'UTF-8');
$cpf       = $cliente->getCpf();
$endereco  = $cliente->getEndereco();
$cidade    = mb_strtoupper($endereco->getCidade(), 'UTF-8');
$rua       = mb_strtoupper($endereco->getRua(), 'UTF-8');
$numero    = $endereco->getNumero();
$telefones = $cliente->getTelefones();
$telefone1 = $telefones[0];
$telefone2 = $telefones[1];

Click here to understand more about the case.

Tip

Whenever possible create your database in UTF8 , LC_COLLATE en_US.UTF-8 and LC_CTYPE en_US.UTF-8 , otherwise you may have this type of problem and others like sort an alphabetical query and it will first bring the ones that start with lowercase letters and then those that start with capital letters (or the opposite, I do not remember).

    
10.02.2017 / 19:17
-1

If your PostgreSQL supports LATIN1 chartset, ap- pleen rebuild the database with the following characteristics:

    CREATE DATABASE nome_do_banco ENCODING 'LATIN1' LC_COLLATE 'pt_BR.ISO-8859-1' LC_CTYPE 'pt_BR.ISO-8859-1' template template0;

Take the test again and see how it went.

    
05.02.2017 / 14:33