You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(daemon): mark code-page cmd launchers with their encoding for deterministic readback
Prepend an ASCII '@Rem openclaw-launcher-encoding=<label>' line to code-page
.cmd launchers and decode by that marker instead of sniffing UTF-8. Some GBK
byte sequences are valid UTF-8 (隆 = C2 A1 reads as ¡), so the old sniff
silently corrupted readback and rejected valid paths; the marker makes decode
deterministic and drops the code-page probe (a PowerShell spawn) from the
frequent readScheduledTaskCommand poll path.
Also fix the representability guard for euc-kr: Node ICU decodes euc-kr as
KS X 1001 only, but Windows code page 949 is cp949/UHC, so the TextDecoder
cross-check false-rejected ~8,800 UHC extension syllables (똠 = 8C 63) that
iconv encodes and cmd.exe reads fine. Verify euc-kr via iconv's own cp949
round-trip; keep TextDecoder for the other five labels.
// corrupt paths; verify the round-trip and fail the install before any
68
+
// launcher file is written. Node ICU's euc-kr decoder is KS X 1001 only, but
69
+
// Windows code page 949 is cp949/UHC, so ICU false-rejects the ~8,800 UHC
70
+
// extension syllables cmd.exe reads fine — verify euc-kr with iconv's own
71
+
// cp949 decode instead. The other five labels match Windows in ICU, which
72
+
// also flags best-fit hazards (shift_jis ¥ -> 0x5C) iconv's decode would miss.
73
+
constdecoded=
74
+
encoding==="euc-kr"
75
+
? iconv.decode(encoded,encoding)
76
+
: newTextDecoder(encoding).decode(encoded);
77
+
if(decoded!==marked){
63
78
thrownewError(
64
79
`Windows ${params.format} launcher script contains characters that cannot be represented in the Windows system code page (${encoding}); cmd.exe would misread the script. Remove those characters or switch Windows to UTF-8 (code page 65001).`,
65
80
);
66
81
}
67
82
returnencoded;
68
83
}
69
84
70
-
/** Decodes launcher scripts written by any OpenClaw version (UTF-16 LE BOM, UTF-8, or ANSI). */
0 commit comments