Merge pull request #352 from cs8425/unicode-filename

use stringToUTF8() not writeAsciiToMemory()
This commit is contained in:
jeromewu 2022-08-14 20:42:46 +08:00 committed by GitHub
commit ae3608f3a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,9 @@
module.exports = (Core, args) => {
const argsPtr = Core._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT);
args.forEach((s, idx) => {
const buf = Core._malloc(s.length + 1);
Core.writeAsciiToMemory(s, buf);
const sz = Core.lengthBytesUTF8(s) + 1;
const buf = Core._malloc(sz);
Core.stringToUTF8(s, buf, sz);
Core.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32');
});
return [args.length, argsPtr];