Repository navigation
Description
Bug description
Multiple Windows printer support reports from Spanish- and Portuguese-language systems contain replacement characters in PowerShell diagnostics. Examples translate to "Exception calling SendRaw" and "Preparing modules for first use," but arrive with the accented characters corrupted (for example, Excepci?n and m?dulos with Unicode replacement glyphs).
This appears repeatedly across receipt and KOT reports, versions 3.5.1 through 3.8.1, and remains possible in the current Windows raw-print transport.
Code validation
printViaUSBWindows() invokes Windows PowerShell through execFileAsync with encoding: 'utf8', but the helper does not force PowerShell's stdout/stderr encoding. Windows PowerShell 5.1 can emit redirected output using a legacy console/OEM encoding. By the time sanitizePowerShellStderr() sees the string, invalid bytes have already become replacement characters and cannot be recovered.
The support ingestion and MySQL columns use Unicode correctly; the corruption is already present in the submitted message. Existing windows-print-stderr.test.ts tests use JavaScript strings and therefore do not exercise subprocess byte decoding on a non-English Windows code page.
Steps to reproduce
- Use Windows PowerShell 5.1 on a Windows installation whose UI/code page is Spanish or Portuguese.
- Trigger a Windows raw-printer failure that emits localized PowerShell progress/error text.
- Submit the resulting printer error or inspect the UI/API detail.
- Observe replacement glyphs where accented characters should appear.
Expected behavior
Printer diagnostics remain valid Unicode regardless of the Windows display language/code page. If localized shell framing is retained, it should be readable; preferably the app should extract a stable English device reason and discard irrelevant PowerShell progress framing.
Actual behavior
Accented characters are irreversibly corrupted before the diagnostic reaches the UI and support ticket, reducing readability and making automated classification/translation less reliable.
Environment
- Windows x64
- Spanish and Portuguese OS locales
- Observed in FloCafe 3.5.1, 3.7.2, and 3.8.1
- Receipt and KOT Windows raw-spooler paths
Acceptance criteria
- The Windows helper explicitly uses a known Unicode encoding for stdout and stderr, or Node decodes the actual emitted encoding correctly.
- CLIXML/progress framing is removed without losing non-ASCII diagnostic text.
- Tests cover accented Spanish and Portuguese stderr at the byte boundary, not only pre-decoded JavaScript strings.
- Existing English error classification and actionable printer messages remain unchanged.
- Support-ticket printer messages contain no Unicode replacement characters introduced by the transport.
Activity
khaira777 commentedon Sep 21, 2026
working on it
fix: force utf-8 output from windows powershell print helpers (#802)