UTF-8 decoding error

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Sep 22 12:04:43 EDT 2006


On Fri, 2006-09-22 at 17:19 +0200, Christian Maeder wrote:
> Christian Maeder schrieb:
> > Duncan Coutts schrieb:
> >> There is iconv. It could be used as a pre-processor with ghc's -F -pgmF
> >> -optF flags.
> > 
> > NB: -F is missing in the Flag reference
> > 
> > A simple script for the pgmF command
> > 
> > #!/bin/sh
> > iconv -f l1 -t utf-8 $2 > $3
> > 
> > worked for me, thanks!
> 
> The only disadvantage is that the filename in error and warning messages
> is quite useless:
> 
> [ 15 of 400] Compiling Data.Generics2.Instances (
> syb-generics/Data/Generics2/Instances.hs,
> syb-generics/Data/Generics2/Instances.o )
> 
> /tmp/ghc5667_0/ghc5667_248.hspp:299:17:

I think you can fix this by pre-pending a {-# LINE #-} pragma in your
script. Something like:

#!/bin/sh
( echo "{-# LINE 1 \"$2\" #-}" ; iconv -f l1 -t utf-8 $2 ) > $3

Duncan



More information about the Glasgow-haskell-users mailing list