Skip to content

Bug: Windows printer diagnostics corrupt non-ASCII PowerShell output #790

Closed

Description

@itsbkm

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

  1. Use Windows PowerShell 5.1 on a Windows installation whose UI/code page is Spanish or Portuguese.
  2. Trigger a Windows raw-printer failure that emits localized PowerShell progress/error text.
  3. Submit the resulting printer error or inspect the UI/API detail.
  4. 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

  1. khaira777 commented on Sep 21, 2026

    @khaira777
    Contributor

    working on it

  2. added a commit that references this issue on Sep 21, 2026
    b56bb5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions