Fix Windows dart-sass failures with accented paths and enterprise .bat blocking#14273
Merged
Fix Windows dart-sass failures with accented paths and enterprise .bat blocking#14273
Conversation
safeWindowsExec writes temp .bat files as UTF-8 (Deno default), but cmd.exe reads them using the OEM code page (e.g., CP850). Multi-byte UTF-8 characters like é (0xC3 0xA9) get misinterpreted, breaking paths with accented characters (e.g., C:\Users\Sébastien\). Add `chcp 65001 >nul` to switch cmd.exe to UTF-8 before the command line is parsed. Use CRLF line endings for correct .bat parsing.
Instead of invoking sass.bat through safeWindowsExec (which creates a temp .bat file via cmd /c), call dart.exe + sass.snapshot directly. This eliminates three classes of Windows .bat file issues: - Deno quoting bug with spaced paths (#13997) - cmd.exe OEM code page misreading UTF-8 accented paths (#14267) - Enterprise group policy blocking .bat execution (#6651) Follows the pattern established by verapdf.ts which bypasses its .bat wrapper for the same reasons.
Explicit installDir option (used by tests) should take precedence over QUARTO_DART_SASS env var, matching the previous sassPath behavior.
Add upstream references for sass.bat template and dart_cli_pkg#67. Rename installDir back to sassPath for consistency with QUARTO_DART_SASS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, dart-sass compilation fails when user paths contain accented characters (e.g.,
C:\Users\Sébastien\). ThesafeWindowsExecwrapper introduced in v1.9 writes temp.batfiles as UTF-8, butcmd.exereads them using the OEM code page (CP850), garbling multi-byte characters likeé.Separately, enterprise environments that block
.batexecution via group policy cannot run dart-sass at all, since it is invoked throughsass.bat.Root Cause
safeWindowsExecusesDeno.writeTextFileSync(UTF-8 default) to write a temp.batfile, then runs it viacmd /c. On systems with OEM code page 850, UTF-8 multi-byte sequences (e.g.,é= 0xC3 0xA9) are misinterpreted as two CP850 characters, producing "file name syntax incorrect" errors.Fix
Two changes, ordered for backportability:
Harden
safeWindowsExec— prependchcp 65001 >nulto generated.batfiles socmd.exeuses UTF-8. Uses CRLF line endings for correct batch parsing. This is the minimal, backportable fix for the encoding regression.Bypass
sass.batentirely — on Windows, calldart.exe+sass.snapshotdirectly viaDeno.Command/execProcessinstead of going throughsass.bat. This eliminates the entire class of.batfile issues (encoding, Deno quoting bugs, enterprise policy blocking). Follows the pattern already used byverapdf.ts.QUARTO_DART_SASSenv var override (used by conda) continues to work as before — it points to a nativesass.exe, not a.bat.Fixes #14267, fixes #6651