Variable returns strange characters

0

I am using the CPU-Z that when scanning your pc you have the option to save the log in txt or html so that it can be viewed manually. Done that I exported to html and executed

INSERT INTO 'root'.'mycomputers'(id, token, html) VALUES (NULL, '08dade78-6f3c-401b-899f-aa7035d001fb', 'CODIGO_HTML_DO_LOG_DO_CPU-Z');
  

Where id is A_I (AutoIncrement)

I made the scheme below so that the html is displayed every time I supply the correct token, but after the query the result returns an unknown character =

<?php
    $token = $_GET["token"];
    $html = "";
    $title = "";

    header ('Content-type: text/html; charset=UTF-8');

    mysql_connect("localhost", "root", "usbw");
    mysql_select_db("root");

    $cmd_q = "SELECT * FROM 'mycomputer' WHERE token='$token'";
    $cmd_r = mysql_query($cmd_q);

    $cmd_s = mysql_fetch_row($cmd_r);
    $html = $cmd_s[2];
    $title = $cmd_s[3];
?>

<head>
    <link rel="shortcut icon" href="http://www.cpuid.com/medias/images/favicon.ico" type="image/x-icon"/>
    <script type="text/javascript">document.title="<?php echo $title; ?>"</script> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta charset="UTF-8" />
</head>
<?php echo $html; ?>

On certain characters as the symbol next to = > ° C representing degrees Celsius. Html within the database returns instead of ° that Temperature 0 32�C (89�F) [0x35] (Core #0)

  

NOTE: In the database the symbol ° appears normally, but in the html it stays this way!

Other lines that occur the same:

     Temperature 0   38�C (100�F) [0x26] (TMPIN0)
        Temperature 1   35�C (95�F) [0x23] (TMPIN1)
        Temperature 2   32�C (89�F) [0x20] (TMPIN2)
        Fan 0   2742 RPM [0x223] (FANIN0)
        Fan 2   2836 RPM [0x211] (FANIN2)
        Fan PWM 0   63 pc [0xA0] (CPU)
        Fan PWM 1   60 pc [0x99] (System Fan 1)
        Fan PWM 2   60 pc [0x99] (System Fan 2)
        Fan PWM 3   60 pc [0x99] (System Fan 3)

Hardware monitor    NVIDIA NVAPI
        Temperature 0   45�C (113�F) [0x2D] (TMPIN0)

JSFiddle

    
asked by anonymous 28.10.2015 / 22:59

1 answer

1

You're having a problem with the character encoding pattern, so try using your html head: change:

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

To:

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    
28.10.2015 / 23:08