Skip to content

Windows agent sessions can silently replace Unicode punctuation with ? before signing messages #6527

Open

Description

@santimon

Windows agent sessions can silently replace Unicode punctuation with ? before signing Buzz messages

Summary

On Windows, an agent session that sends generated message content from Windows PowerShell 5.1 through buzz messages send --content - without explicitly setting UTF-8 pipe encoding can silently replace non-ASCII characters with ASCII question marks before the Nostr event is built and signed.

This is easy to miss because the command succeeds, the relay accepts the event, and Buzz Desktop faithfully renders the already-corrupted event. The corruption is permanent in message history and can vary between per-channel sessions of the same agent.

Observed behavior

Intended text:

The standalone laptop is a solid call — it solves the availability concern.
No desktop environment needed — less to patch, less to break.

Stored/rendered text:

The standalone laptop is a solid call ? it solves the availability concern.
No desktop environment needed ? less to patch, less to break.

The substitution repeats at every intended em dash. This is not mojibake such as —, and it is not a Desktop rendering error: the outbound PowerShell/native-process boundary has already converted U+2014 to U+003F before submission.

Environment

  • Windows 11
  • Windows PowerShell 5.1.26100.9168
  • Buzz managed ACP agent sessions
  • Buzz CLI invoked by the agent harness
  • One independent agent session per channel

Reproduction

From Windows PowerShell 5.1, pipe Unicode prose to the CLI without first setting $OutputEncoding to UTF-8:

$message = 'alpha — beta “quoted” café'
$message | buzz messages send --channel <channel-uuid> --content -

Fetch the resulting signed event and inspect its content code points. Depending on the active legacy encoding, unsupported characters can be stored as ? (U+003F) or otherwise corrupted.

The immediate workaround is:

$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::new()
$message | buzz messages send --channel <channel-uuid> --content -

However, a prompt/workspace instruction is insufficient because each channel has an independent, potentially long-running agent session. One session can comply while another session of the same agent continues using the unsafe encoding.

Expected behavior

Every Windows agent session should preserve generated Unicode text byte-for-byte through CLI submission without relying on prompt compliance or per-command shell setup.

Proposed fix

Initialize every Windows PowerShell process spawned by buzz-acp with explicit BOM-less UTF-8 input/output encoding before agent commands execute:

$OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::new()

Also consider removing the shell encoding boundary from human-facing message submission:

  • provide a buzz messages send --content-file <path> option that reads UTF-8 explicitly; or
  • have the harness invoke the CLI directly and write UTF-8 bytes to stdin rather than constructing PowerShell command arguments.

Regression test

Add a Windows end-to-end test that sends the following through the same harness path used by managed agents:

em dash — curly quotes “test” accented café CJK 測試 emoji 🐝

Fetch the accepted event and assert exact Unicode scalar values in content, not only successful command exit or visual rendering. Run the test for two independent channel sessions to cover per-session initialization.

Impact

  • Signed message history can be permanently altered before relay ingestion.
  • The failure is silent: the CLI reports success.
  • Multiple sessions of one agent can behave differently.
  • Human readers may incorrectly attribute the problem to Desktop rendering or relay storage.

Activity

  1. luckerninja commented on Sep 4, 2026

    @luckerninja

    Additional Windows reproduction affecting full Cyrillic messages, not only punctuation (2026-09-04):

    • A managed agent passed Russian Markdown through Windows PowerShell to buzz messages send --content -.
    • The CLI succeeded and the relay accepted the event, but almost every Cyrillic character had already become literal ASCII ? in the signed content.
    • Technical ASCII fragments such as product, CREATE / UPDATE / DELETE, report/stock/all, command names, hashes, and deep links survived, which makes the failure especially deceptive.
    • Two affected event IDs on the reporter's relay are 9c4eff2450477d0349a22bb1668b2f9ce333ae41e4c1223e1b6660f58fd79bcb and 65f66c176bb618764ecfe3c1c93008bcda6827d481429a54f1e184f760c6f8cf.

    The operational workaround was changed to pass Unicode text directly as the --content argument on Windows, then fetch the accepted event back from the relay and verify the stored content. A subsequent Cyrillic message sent through that path was preserved correctly.

    This supports making Unicode safety a platform contract rather than a prompt/memory convention. In addition to initializing PowerShell with UTF-8, the CLI/harness should ideally provide an encoding-explicit submission path and a Windows regression test containing Cyrillic, CJK, punctuation, and emoji, asserting the exact stored event content.

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