这是pbcopy命令乱码bug吗?

问题描述 投票:0回答:1

这是

pbcopy
命令乱码bug吗? 如果是这样,有没有办法解决它?

我已经尝试了几种方法,但仍然找不到为什么会这样。

更新

在终端中打开它是可以的,但是在文件编辑器(vscode)中打开它时会出现乱码

# ✅ terminal
$ cat man-grep.md

# ❌ vscode
$ code -n man-grep.md

vscode 切换

UTF-8
/
UTF-16
都根本不起作用?

screenshot gif
https://cdn.xgqfrms.xyz/Linux/unicode-garbled-bug.gif

错误/错误

重现步骤

# 1. copy output
$ man grep | pbcopy

# 2. paste to a markdown file

# 3. view the markdown file

vscode
打开
markdown
文件,还是乱码

模板解决方案

  1. 输出到降价文件
# stdout
$ man ls > man-ls.md
# $ man grep > man-grep.md

# no pagination problem ✅
$ cat man-ls.md
# $ cat man-grep.md

  1. 手动复制粘贴(逐页👎)
# copy man docs, page by page
$ man grep

shell markdown stdout manpage pbcopy
1个回答
0
投票

vscode
解决方案 ✅

使用

vscode
修复从终端编码错误的复制🚀

步骤

  1. 导出一个
    .md
    降价文件
# export
$ man shutdown > shutdown.md
# $ man grep > grep.md

  1. 用vscode打开导出的

    .md
    文件

  2. 全选

    "
    符号,按
    backspace
    /
    back delete
    键两次(
    🔙
    )

就这些了

gif
演示

© www.soinside.com 2019 - 2024. All rights reserved.