Skip to content

Non-ASCII link hook output is corrupted by dart build cli on Windows #3593

Closed

Description

@dzylikecode

Environment

  • Windows x64, Simplified Chinese
  • Dart SDK 3.13.1

Problem

Running:

dart build cli --target .\example\call.dart

displays corrupted Chinese output from the link hook:

Running link hooks... 淇℃伅: 鐢ㄦ彁渚涚殑妯″紡鏃犳硶鎵惧埌鏂囦欢銆?

After the failure, the Dart CLI prints a command for reproducing the link hook invocation. It has the following form:

dart.exe `
  --packages=<package-config> `
  <hook.dill> `
  --config=<hook-input.json> `
  <recorded-uses.json>

Running that command directly displays the same output correctly:

Running `where.exe vswhere.exe`.
信息: 用提供的模式无法找到文件。

The link hook therefore produces correct Chinese output when invoked directly, but the output is corrupted when invoked and displayed through dart build cli

Activity

  1. dzylikecode commented on Aug 28, 2026

    @dzylikecode
    ContributorAuthor

    My guess is that the hook correctly decodes the original GBK output and writes it to stdout as UTF-8. dart build cli then captures those UTF-8 bytes but decodes them again using the Windows system encoding (GBK), resulting in mojibake.

  2. dcharkes commented on Aug 28, 2026

    @dcharkes
    Collaborator

    Hi @dzylikecode Thanks for the report! 20 years of software engineering, and I'm still fighting mojibake! 😆

    The implementation for this is in

    Would you be able to try to build the Dart SDK locally find a fix and supply a PR?

  3. added
    contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)
    and removed
    needs-triageNeeds triage from the team. Remove this label once triaged.
    on Aug 28, 2026
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

    contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)package:hooks_runner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions