title: Weird Question Marks in JavaScript
body: <p>I'm trying to create a script that pings my Minecraft server to check how many players are online, but for some reason question marks are getting displayed and it makes the whole website look like crap. Here's my PHP file.</p>
  
  <pre><code>&lt;script&gt;
      function setOnline(online,max) {
          var on = online;
          var mx = max;
  
          var main = document.getElementById('status_main');
          main.className = "panel panel-success server-status";
  
          var title = document.getElementById('status_title');
          title.innerHTML = "Online";
  
          var body = document.getElementById('status_body');
          body.innerHTML = on + "/" + mx + " Players Online";
      }
  &lt;/script&gt;
  
  &lt;script&gt;
      function setOffline() {
          var bar = document.getElementById('status');
          bar.className = "panel panel-danger server-status";
          bar.text = "Offline";
      }
  &lt;/script&gt;
  &lt;?php
  $host = "localhost"; //IP/host of Minecraft server
  $port = 25565; //Minecraft server port, not query port
  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //Create the socket
  $connected = socket_connect($socket, $host, $port); //Try and connect using the info provided above
   if (!$connected)
      die(); //No connection could be established
  
  socket_send($socket, "\xFE\x01", 2, 0); //Send the server list ping request (two bytes)
  $retVal = socket_recv($socket, &amp;$data, 1024, 0); //Get the info and store it in $data
  socket_close($socket); //Close socket
  
  if ($retVal != false &amp;&amp; substr($data, 0, 1) == "\xFF") //Ensure we're getting a kick message as expected
  {
      $data = substr($data, 9); //Remove packet, length and starting characters
      $data = explode("\x00\x00", $data); //0000 separated info
      $protocolVersion = $data[0]; //Get it all into separate variables
      $serverVersion = $data[1];
      $motd = $data[2];
      $playersOnline = $data[3];
      $playersMax = $data[4];
      echo ("&lt;script&gt;setOnline('$playersOnline','$playersMax');&lt;/script&gt;");
  }
  else
  {
      die();
  }
  ?&gt;
  </code></pre>
  
  <p>Here's what the result looks like when it's called:
  <a href="http://cl.ly/image/3o2f3P121q0m" rel="nofollow">http://cl.ly/image/3o2f3P121q0m</a></p>
  
  <p>How can I get rid of the question marks?</p>