How can I code a MySQL query to UTF-8?

0

Bendo with a problem that ails.

All the records that I insert into my database are saved with characters of this type (or). This is a (ó). My problem is that I am using a function to encode it as UTF-8 when it comes to consulting the information but it does not arrive processed. The code I use is the following:

public function read($orden_id)
{
    $arrayTemporal = $this->ordenController->read($orden_id);
    $this->orden = $this->utf8size($arrayTemporal);
    echo json_encode($this->orden, JSON_PRETTY_PRINT);
}

public function utf8size($d) {
    if (is_array($d)) {
        foreach ($d as $k => $v) {
            $d[$k] = $this->utf8size($v);
        }
    } else if (is_string ($d)) {
        return utf8_encode($d);
    }
    return $d;
} 

If someone can help me, I will be very grateful. Without more for the moment I say goodbye.

    
asked by JOSE ANGEL JIMENEZ CALDERON 02.03.2018 в 19:53
source

0 answers