Have redbean Lua repl show utf-8 when it's valid

Otherwise EncodeLua() will assume strings are binary and display them
using hex sequences.
This commit is contained in:
Justine Tunney 2022-07-23 06:47:01 -07:00
parent 31e4b0867b
commit ce5cb8a2f8
10 changed files with 217 additions and 35 deletions

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/dce.h"
#include "libc/intrin/promises.internal.h"
#include "libc/log/libfatal.internal.h"
#include "libc/log/log.h"
#include "libc/nexgen32e/vendor.internal.h"
@ -44,6 +45,7 @@ int IsDebuggerPresent(bool force) {
if (!force && __getenv(environ, "HEISENDEBUG")) return 0;
if (IsWindows()) return IsBeingDebugged();
if (__isworker) return false;
if (!PLEDGED(RPATH)) return false;
res = 0;
if ((fd = __sysv_open("/proc/self/status", O_RDONLY, 0)) >= 0) {
if ((got = __sysv_read(fd, buf, sizeof(buf) - 1)) > 0) {