Merge pull request #549 from Naahuel/master

Add change encoding to bat file for dtutils/system.lua windows_command

Thanks.
This commit is contained in:
wpferguson
2025-01-07 13:42:54 -05:00
committed by GitHub

View File

@@ -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)