[Haskell-cafe] Has character changed in GHC 6.8?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Jan 22 08:18:00 EST 2008


On Tue, 2008-01-22 at 13:48 +0100, Henning Thielemann wrote:
> On Tue, 22 Jan 2008, Duncan Coutts wrote:
> 
> > > At the time I thought that the encoding (in my case UTF-8) was “leaking
> > > through”.  After switching to GHC 6.8 the behaviour seems to have
> > > changed, and mapping 'ord' on a string results in a list of ints
> > > representing the Unicode code point rather than the encoding:
> >
> > Yes. GHC 6.8 treats .hs files as UTF-8 where it previously treated them
> > as Latin-1.
> 
> Can this be controlled by an option?

>From the GHC manual:

        GHC assumes that source files are ASCII or UTF-8 only, other
        encodings are not recognised. However, invalid UTF-8 sequences
        will be ignored in comments, so it is possible to use other
        encodings such as Latin-1, as long as the non-comment source
        code is ASCII only.

There is no option to have GHC assume a different encoding. You can use
something like iconv to convert .hs files from another encoding into
UTF-8.

Duncan



More information about the Haskell-Cafe mailing list