From 1e33ea419266a93858664d0d85daa0aa91ee719d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nahuel=20Jos=C3=A9?= Date: Mon, 6 Jan 2025 18:47:57 -0300 Subject: [PATCH] fix: add change encoding to bat file for dtutils windows_command --- lib/dtutils/system.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/dtutils/system.lua b/lib/dtutils/system.lua index 0df0dee..f7db561 100644 --- a/lib/dtutils/system.lua +++ b/lib/dtutils/system.lua @@ -87,7 +87,13 @@ function dtutils_system.windows_command(command) if file then dt.print_log("opened file") command = string.gsub(command, "%%", "%%%%") -- escape % from windows shell - file:write(command) + file:write("@echo off\n") + file:write('for /f "tokens=2 delims=:." %%x in (\'chcp\') do set cp=%%x\n') + file:write("chcp 65001>nul\n") -- change the encoding of the terminal to handle non-english characters in path + file:write("\n") + file:write(command .. "\n") + file:write("\n") + file:write("chcp %%cp%%>nul\n") file:close() result = dt.control.execute(fname)