Skip to content

Commit 9ff7599

Browse files
Critsium-xyclaude
andauthored
Support non-ASCII (CJK) paths in Windows installer (deepmodeling#7342)
Force UTF-8 at the top of install-abacus.bat, uninstall-abacus.bat, and the generated abacus.cmd / abacus-mpi.cmd launchers via `chcp 65001` and `set WSL_UTF8=1`. Without these, wsl.exe emits UTF-16LE when its stdout is piped, so the `for /f` that captures `wslpath` output mangles any CJK characters in the repository or case directory path, and the launchers' `wsl --cd "%CD%"` fails from a Chinese-named directory. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 43024cc commit 9ff7599

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

tools/windows/install-abacus.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
@echo off
22
setlocal EnableExtensions EnableDelayedExpansion
3+
REM Force UTF-8 so paths containing non-ASCII (e.g. CJK) characters survive
4+
REM round-tripping through wsl.exe. WSL_UTF8 makes wsl.exe emit UTF-8 when
5+
REM its stdout is piped (otherwise it emits UTF-16LE and `for /f` mangles
6+
REM the result); chcp 65001 lets cmd decode that UTF-8 cleanly.
7+
chcp 65001 >nul
8+
set "WSL_UTF8=1"
39
title ABACUS for Windows (WSL2) Installer
410

511
set "DISTRO=Ubuntu-22.04"
@@ -128,10 +134,14 @@ REM --- 6. Install Windows-side launchers ---
128134
if not exist "%BIN_DIR%" mkdir "%BIN_DIR%"
129135

130136
> "%BIN_DIR%\abacus.cmd" echo @echo off
137+
>> "%BIN_DIR%\abacus.cmd" echo chcp 65001 ^>nul
138+
>> "%BIN_DIR%\abacus.cmd" echo set "WSL_UTF8=1"
131139
>> "%BIN_DIR%\abacus.cmd" echo set "WSLENV=OMP_NUM_THREADS:MKL_NUM_THREADS:OPENBLAS_NUM_THREADS:%%WSLENV%%"
132140
>> "%BIN_DIR%\abacus.cmd" echo wsl -d %DISTRO% --cd "%%CD%%" -- abacus %%*
133141

134142
> "%BIN_DIR%\abacus-mpi.cmd" echo @echo off
143+
>> "%BIN_DIR%\abacus-mpi.cmd" echo chcp 65001 ^>nul
144+
>> "%BIN_DIR%\abacus-mpi.cmd" echo set "WSL_UTF8=1"
135145
>> "%BIN_DIR%\abacus-mpi.cmd" echo set "WSLENV=OMP_NUM_THREADS:MKL_NUM_THREADS:OPENBLAS_NUM_THREADS:%%WSLENV%%"
136146
>> "%BIN_DIR%\abacus-mpi.cmd" echo wsl -d %DISTRO% --cd "%%CD%%" -- abacus-mpi %%*
137147

tools/windows/uninstall-abacus.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@echo off
22
setlocal EnableExtensions EnableDelayedExpansion
3+
REM Force UTF-8 so paths with non-ASCII (e.g. CJK) characters survive
4+
REM round-tripping through wsl.exe (see install-abacus.bat for details).
5+
chcp 65001 >nul
6+
set "WSL_UTF8=1"
37
title ABACUS Uninstaller
48

59
set "DISTRO=Ubuntu-22.04"

0 commit comments

Comments
 (0)