patch applied (cabal): First pass at parsing .cabal files as UTF8

Ross Paterson ross at
Tue Feb 26 04:58:49 EST 2008

On Tue, Feb 26, 2008 at 09:30:41AM +0000, Duncan Coutts wrote:
> So if we use files opened in binary mode and account for line end
> differences then this is portable and doesn't make it harder for GHC to
> switch text handles to use a more sensible encoding.

Yes.  We have to handle line-endings independently of the host system
anyway, because the files we're reading could have been created on a
different system.

> It doesn't actually change the fact that our error messages will print
> garbage when they include snippets of a .cabal file that contained
> non-ISO-8859-1 chars.

Yes, because GHC's text handles cannot cope with such characters.
So instead of trying to patch around that, how about just replacing these
characters with "???" or "<U+9E00>" on output (if compiling with GHC)?
It's not pretty, but hopefully it's temporary, and these are only error
message we're talking about.

More information about the cabal-devel mailing list