Tuesday, April 27, 2010

GHCi 6.12 unicode emacs problem

I recently installed the Haskell Platform with GHC version 6.12.1 on my Mac.  The primary problem for me has been getting unicode to work correctly.  I was using the utf8-string package, but now it is no longer necessary.  For instance,

main = putStrLn "π x. p(x)"

works correctly when compiled.  However, I had trouble getting it to work via the emacs interactive buffer.  I found that when creating a ghci buffer with `inferior-haskell-load-file'  my bash shell variables, in particular LC_CTYPE, were not getting set.  I thus created a new program that first sets LC_CTYPE and then calls ghci.  This gets the unicode to print correctly in the inferior buffer.

#!/bin/bash

export LC_CTYPE="en_US.UTF-8"
ghci

I then customize `haskell-program-name' to be the name of this file.  If someone knows a better way to do this, please let me know.

No comments:

Post a Comment