armorcore icon indicating copy to clipboard operation
armorcore copied to clipboard

Fix UT8 handling in fs_writefile

Open MathemanFlo opened this issue 1 year ago • 1 comments

Fixes https://github.com/armory3d/armortools/issues/1768 Thanks to @shiena s investigation it was easy to see that non ascii utf8 glyphs where handled incorrectly because they take more than one byte. charCodeAt retrieves a utf16 code point though because JavaScript stores string in utf16 encoding internally. Therefore the solution to convert to utf8 first.

MathemanFlo avatar Sep 24 '24 15:09 MathemanFlo

@MathemanFlo I tried this patch. The correct character encoding was output in Japanese, so it seems to be OK.

shiena avatar Sep 24 '24 17:09 shiena

Thanks for figuring out what's wrong! I found a FILE.puts(str) method at https://bellard.org/quickjs/quickjs.html which seems to do the trick. Will do some more testing.

https://github.com/armory3d/armorcore/commit/c24dfade5ecc2627bd5faa69044cc346053062b0

luboslenco avatar Oct 25 '24 15:10 luboslenco