Codeigniter PHP parameter coding problem

Asked

Viewed 152 times

0

I have an autocomplete that makes connection via ajax, but when I typed letters with accent that are even in the database the query did not return anything. Both the bank, php.ini and the codeigniter settings (database.php, config.php) are setando utf-8, the files are saved with UTF-8 as well.

Autocompletes:

Screenshot 1 autocomplete Screenshot 2 autocomplete

Ai decided to test by accessing the direct url, for the method of getLocalidadesByUf of controller Base.php, and print the parameter to see how it was coming, type cameo, but when the page is submitted the value arrives as *cama%C3%A7*

class Base extends CI_Controller 
{
  public function getLocalidadesByUf($uf, $nome) { 
    echo json_encode($this->uf_model->getLocalidadesByUf($uf, $nome), JSON_UNESCAPED_UNICODE); 
  }
}

Screenshot do URL no browser

I’m really lost and I don’t know what to do?

  • Is this going to get? Could you put the code.

  • 1

    If you go by REST the consumer URL will look like this even the indexer has to give a UTF8 Decode at the time of the query... Send the indexer..

  • @rray just made a function that queries the same data... and follow the default url of codeigniter... class Base extends CI_Controller { public function getLocalidadesByUf($uf, $nome){
 echo json_encode($this->uf_model->getLocalidadesByUf($uf, $nome), JSON_UNESCAPED_UNICODE);
 }

  • @Dom tou usando o padrão do codeigniter... https://github.com/bcit-ci/CodeIgniter/blob/develop/index.php

No answers

Browser other questions tagged

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