我如何将GHCi提示符设置为Windows上的lambda字符? [英] How can I set my GHCi prompt to a lambda character on Windows?

查看:196
本文介绍了我如何将GHCi提示符设置为Windows上的lambda字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在Windows 7的GHCi(7.8)中有一个lambda(λ)符号作为我的提示符,所以我将 .ghci 文件设置为

I want to have a lambda (λ) symbol as my prompt in GHCi (7.8) on Windows 7, so I set up my .ghci file as

:set +m
:set prompt  "λ: "
:set prompt2 " | "

我将控制台字体设置为Lucida Console,因为它应该支持Unicode,但是当我加载GHCi时,而不是像这样

And I set my console font to Lucida Console since it's supposed to support Unicode, but when I load up GHCi, it looks like this instead

如何让Windows正确识别λ符号?

How can I get Windows to recognize the λ symbol properly?

推荐答案

其实很简单,只需在启动GHCi之前运行以下命令:

This is actually quite a simple fix, just run the following command before starting GHCi:

> chcp.com 65001

这将Window的编码设置为65001代码页,这样可以正确显示λ :

This sets Window's encoding to the 65001 code page, which lets the λ get displayed properly:

这也会让很多其他Unicode字符在 cmd.exe 和其他Windows shell(如Cygwin bash ),但是Windows的Unicode支持仍然不完美,有些字体不支持许多字符。幸运的是,λ恰好是支持的角色,所以我们都可以拥有经典的GHCi提示。

This will also let a lot of other Unicode characters be displayed properly in cmd.exe and other Windows shells (such as Cygwin bash), but Windows' Unicode support is still not perfect, and some fonts don't support many of the characters. Luckily, λ happens to be a supported character so we can all have the classic GHCi prompt.

这篇关于我如何将GHCi提示符设置为Windows上的lambda字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆