为什么堆栈在 windows 上的错误输出中有奇怪的字符编码?
Why does stack give wierd charcter encoding in error output on windows?
我有一个包含以下内容的文件 tmp.hs
:
{- stack
script
--resolver lts-10.3
-}
当我 运行 stack tmp.hs
我得到以下输出
?[;1mC:\Users\ludvig.hult\Source\adventofcode2016\Day1\tmp.hs:0:53: ?[;1m?[31merror:?[0m?[0m?[;1m?[0m?[0m?[;1m
* Variable not in scope: main :: IO a0
* Perhaps you meant `min' (imported from Prelude)?[0m?[0m
运行在我的 windows 10 机器上的 CMD 或 PowerShell 中。这是什么错误?字符编码?我该如何解决?
这是ANSI颜色控制代码。您可以使用 --color never
抑制它们。这可能是由于 windows 10 秋季创作者更新导致默认情况下不再解析 ANSI 代码。相反,应用程序需要选择加入。
请考虑对这个问题实施修复,可能在 ansi-terminal 包中 https://github.com/commercialhaskell/stack/issues/3797 . https://github.com/commercialhaskell/stack/issues/3785 也可能相关。
最后,简单地添加到配置中将对此有所帮助 - 指定 color: never
的能力 - 请参阅 https://github.com/commercialhaskell/stack/issues/3778
我有一个包含以下内容的文件 tmp.hs
:
{- stack
script
--resolver lts-10.3
-}
当我 运行 stack tmp.hs
我得到以下输出
?[;1mC:\Users\ludvig.hult\Source\adventofcode2016\Day1\tmp.hs:0:53: ?[;1m?[31merror:?[0m?[0m?[;1m?[0m?[0m?[;1m
* Variable not in scope: main :: IO a0
* Perhaps you meant `min' (imported from Prelude)?[0m?[0m
运行在我的 windows 10 机器上的 CMD 或 PowerShell 中。这是什么错误?字符编码?我该如何解决?
这是ANSI颜色控制代码。您可以使用 --color never
抑制它们。这可能是由于 windows 10 秋季创作者更新导致默认情况下不再解析 ANSI 代码。相反,应用程序需要选择加入。
请考虑对这个问题实施修复,可能在 ansi-terminal 包中 https://github.com/commercialhaskell/stack/issues/3797 . https://github.com/commercialhaskell/stack/issues/3785 也可能相关。
最后,简单地添加到配置中将对此有所帮助 - 指定 color: never
的能力 - 请参阅 https://github.com/commercialhaskell/stack/issues/3778