diff --git a/php-console.js b/php-console.js index 58bbbf0..7a48405 100644 --- a/php-console.js +++ b/php-console.js @@ -72,11 +72,28 @@ if (window.localStorage) { localStorage.setItem('phpCode', editor.getSession().getValue()); } + + var controlChars = { + 'NUL' : /\x00/g, + 'SOH' : /\x01/g, + 'STX' : /\x02/g, + 'ETX' : /\x03/g, + 'EOT' : /\x04/g, + 'ENQ' : /\x05/g, + 'ACK' : /\x06/g, + 'BEL' : /\x07/g, + 'BS' : /\x08/g, + 'SUB' : /\x1A/g, + }; // eval server-side $.post('?js=1', { code: editor.getSession().getValue() }, function (res) { if (res.match(/#end-php-console-output#$/)) { - $('div.output').html(res.substring(0, res.length - 24)); + var result = res.substring(0, res.length - 24); + for (var k in controlChars) { + result = result.replace(controlChars[k], ''+ k +''); + } + $('div.output').html(result); } else { $('div.output').html(res + "

Script ended unexpectedly."); } diff --git a/styles.css b/styles.css index 650735e..3931024 100644 --- a/styles.css +++ b/styles.css @@ -94,4 +94,13 @@ a { } .footer a { color: #aaa; +} + +.krumo-root .control-char { + background: #000; + color: #fff; + margin-left: 2px; + margin-right: 2px; + -webkit-border-radius: 5px; + border-radius: 5px; } \ No newline at end of file