Just to throw that in: 

    foreach (array_filter($charcode) as $char) 
      $decimal = octdec($char);
      if (20 <= $decimal && $decimal <= 127) {
        $converted .= chr($decimal);
      }
    }