php - Retrieve column names as single string with comma separation while formatting special characters with MySQL5.5 and PHP5.6

one text

In one database I have a number of columns relating to temperature and voltage. What I need to do is collect the column names of said table and have them formatted into a single string with comma separation of which I have done. The only issue is, is that because degrees celsius is formatted with its special degrees character (?�C), it throws out the formatting of the string and returns weird characters for what the degrees symbol is.

Actual table column name = Internal Battery Temperature (?�C)

My sql statement:

<?php
$sqlState = new ReturnClass; // class with 3 public members: $success, $message, and $data
$conn = openSQL($sqlState); // returns new mysqli(...)

$sqlChannelNames = "SELECT GROUP_CONCAT(COLUMN_NAME ORDER BY ordinal_position)
                    FROM information_schema.columns
                    WHERE table_schema = '$device_id' 
                    AND table_name = '$device_name';"

$result = executeSql($conn, $sqlChannelNames, $retval);

for ($setChannelNames = array (); $rowChannel = $result->fetch_assoc(); $setChannelNames[] = $rowChannel);

var_dump($setChannelNames);

foreach($setChannelNames as $rowChannel){
    var_dump($rowChannel);

    $channels = $rowChannel['Channels'];
    echo ("CHANNELS: $channels\n");
}


function executeSql($conn, $sql, $status)
{
    // check result
    if ($result = $conn->query($sql)) {
        $status->message = "";
        $status->success = true;
    }
    else {
        $status->message = "Could not execute a query on the database."; //mysqli_error($conn); //"
        $status->success = false;
    }
    return $result;
}
?>

Which results in the output for temperature in my powershell console as:

Internal Battery Temperature (?�????�?�???�??�?��?��C)

Datatype for this column name is: VARCHAR Collation: latin1_swedish_ci

How can I keep the formatting of the deg symbol?

Source