deno Windows下乱码,怎么解决?这是Rust的通病么?

C:\Users\houwenbin>deno --version
deno 1.0.5
v8 8.4.300
typescript 3.9.2

以下乱码,都是一个个粗粗的<–和一串22m

C:\Users\houwenbin>deno info
e[0me[1mDENO_DIR location:e[0m "C:\Users\hou
e[0me[1mRemote modules cache:e[0m "C:\Users\
e[0me[1mTypeScript compiler cache:e[0m "C:\Us

C:\Users\houwenbin>deno
Deno 1.0.5
exit using ctrl+d or close()

console.log(“hello %s, %d”,“deno”, 123);
hello deno, 123
e[2mundefinede[22m
console.log(123)
e[33m123e[39m
e[2mundefinede[22m

是 Windows 系统的 cmd 吗?

deno info 命令使用了某些 ANSI 转义序列,但是 Windows 的 cmd 对 ANSI 转义序列支持有限,所以导致了乱码。

如果你说 windows,试试 powershell。

是的,果然powershell好多了,3Q

这是 cmd 的编码解析问题,不是 Deno 的问题
临时修改: 直接在 powershell 中执行 chcp 命令 chcp 65001
永久修改: 百度windows修改powershell 或 cmd 默认编码注册表,
一般在这个位置: 计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

1 个赞