When running DeepSeek Harness (DSH) in a Windows environment, garbled command-line output is frequently encountered. The built-in bash/pwsh tools force GBK or UTF-16LE byte streams to be decoded as UTF-8, causing Chinese text to appear as garbled characters. The dsh-encoding plugin solves this problem by providing separate command execution and garbled-text decoding tools.

What This Is

This is a client plugin maintained by Lostforest7, positioned as an encoding-correction command runner and garbled-text recovery tool for DSH. It is a zero-dependency, pure ESM JavaScript plugin that can run without a build step.

Core Features

The plugin provides two main tools:

  • encoding_run: Starts a subprocess and captures raw bytes from standard output and standard error, automatically detects UTF-8, UTF-16LE, or GBK encoding and decodes them correctly.
  • encoding_decode: Recovers already garbled text. For example, when GBK bytes are misread as Latin1, it can restore the garbled characters to correct Chinese.

Installation and Enablement

Run the following command in the terminal to install the plugin:

dsh plugin --profile <name> add dsh-encoding

After installation is complete, the plugin configuration layer appears in DSH’s configuration output.

Typical Usage

1. Use encoding_run to Execute Commands

This tool is used to execute commands and handle output encoding correctly. If the output contains U+FFFD (�), the system appends a warning line.

encoding_run with command: "chcp 936 >nul & echo 中文"

Output example:

中文
[encoding: gbk (auto-detected)]
[exit code: 0]

Parameters:
* command: The command line to execute.
* encoding: Specifies the encoding mode (auto for automatic detection, or force specify utf-8 / utf-16le / gbk).

2. Use encoding_decode to Recover Garbled Text

This tool is used to repair existing garbled text.

encoding_decode with text: "ÖÐÎÄ"

Parameters:
* text: The garbled text to recover.
* from: The original encoding of the garbled text (default auto, supports latin1 / utf-16le). Note: from=gbk is not supported.
* to: The target decoding encoding (default auto, supports gbk / utf-16le).

Applicable Scenarios and Notes

  • Applicable scenarios: On Windows, when using legacy CLI tools, Git Bash/MSYS2, or PowerShell 5.1, and these tools output GBK-encoded text.
  • Dependencies: The plugin does not replace or fix the built-in bash/pwsh tools; it is only a complementary solution.
  • Permission limitations: encoding_run has no sandbox, approval, or background-task integration, and runs with the same permissions as the Harness process.
  • Detection limitations: Encoding detection is heuristic-based. When encodings are ambiguous (for example, pure Chinese UTF-16LE without BOM versus GBK), it is recommended to force the encoding parameter.
  • Data limitations: Output streams are limited to 8 MiB.

Conclusion

dsh-encoding solves the garbled-output problem when DSH handles certain encoded output on Windows, providing two practical tools: encoding_run and encoding_decode. For scenarios that require handling GBK or UTF-16LE output, this is a lightweight complementary solution.