ref: 5c28fc0ab1342098db749c8d07073cf60b149bfb
parent: a37c98d83d1d059021305f25fecb43c63f4dab40
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Jan 8 13:28:34 EST 2024
Make UTF8 to String conversion respect UTF encoding.
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1690,7 +1690,21 @@
NODEPTR
mkStringU(struct ustring *str)
{- return mkString((const char *)str->string, str->size);
+ BFILE *ubuf = add_utf8(openb_buf(str->string, str->size));
+ NODEPTR n, *np;
+
+ n = mkNil();
+ np = &n;
+ for(;;) {+ int c = getb(ubuf);
+ if (c < 0)
+ break;
+ NODEPTR nc = mkInt(c);
+ *np = mkCons(nc, *np);
+ np = &ARG(*np);
+ }
+ closeb(ubuf);
+ return n;
}
void eval(NODEPTR n);
--
⑨