armortools icon indicating copy to clipboard operation
armortools copied to clipboard

extra_locales.js does not output utf8

Open shiena opened this issue 1 year ago • 1 comments

ArmorPaint version:

2ff0218e553affd69255d6ff3a032156fc5c393f

OS / GPU model: Windows11

Issue description: extra_locales.js does not output utf8, which breaks the locale file; on Windows, the default character encoding for Japanese locales is ShiftJIS, which does not match. Therefore, you should explicitly specify utf8.

Steps to reproduce:

set ARM_LOCALE="ja"
.\armorcore\make --js .\base\tools\extract_locales.js

shiena avatar Sep 24 '24 04:09 shiena

When the following changes were made and output to the console instead of a file, the character encoding was fine. Therefore, there seems to be a character encoding problem with the fs_writefile function.

diff --git a/base/tools/extract_locales.js b/base/tools/extract_locales.js
index e4a7aab8..23f10159 100644
--- a/base/tools/extract_locales.js
+++ b/base/tools/extract_locales.js
@@ -71,4 +71,5 @@ for (let path of source_paths) {
     }
 }
 
-fs_writefile(locale_path, JSON.stringify(out, Object.keys(out).sort(), 4));
+// fs_writefile(locale_path, JSON.stringify(out, Object.keys(out).sort(), 4));
+console.log(JSON.stringify(out, Object.keys(out).sort(), 4));

shiena avatar Sep 24 '24 12:09 shiena

Fix at https://github.com/armory3d/armorcore/commit/c24dfade5ecc2627bd5faa69044cc346053062b0. Thanks for report!

luboslenco avatar Oct 25 '24 15:10 luboslenco