Skip to content

解码错误导致二维码乱码 #6

@HRXWEB

Description

@HRXWEB

现象

Image

原因

  1. setup.ts 第一行写了 #!/usr/bin/env bun(为了 bun setup.ts 直接运行方便)
  2. bun build --target node 保留了 shebang,并自动追加 // @Bun 标记
  3. cli.mjs 用 bun 运行 dist/setup.js 时,bun 看到 // @Bun 后切换到优化的加载路径
  4. 这个优化路径将文件内容按 Latin-1 解码(而非 UTF-8)
  5. qrcode-terminal 里的 █▀▄ 字符被双重编码 → 显示为 â

这是一个 bun 的 bug:// @Bun 标记触发的优化加载路径不应该把文件当作 Latin-1 处理。

解决方案

#5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions