Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hGetContents: invalid argument (invalid byte sequence) #2

Open
hvr opened this issue Jan 2, 2012 · 0 comments
Open

hGetContents: invalid argument (invalid byte sequence) #2

hvr opened this issue Jan 2, 2012 · 0 comments

Comments

@hvr
Copy link
Contributor

hvr commented Jan 2, 2012

Currently, Language.Haskell.Extract, interacts with the LANG environment variable, leading to surprising failures. E.g. when compiling

{-# LANGUAGE UnicodeSyntax, TemplateHaskell #-}

module Foo where

import Language.Haskell.Extract

foo  α  α
foo x = x

bar = $(functionExtractor "oo$")

without any set LANG variable on Linux, you get a

Foo.hs:10:9:
    Exception when trying to run compile-time code:
      Foo.hs: hGetContents: invalid argument (invalid byte sequence)
      Code: functionExtractor "oo$"
    In the expression: $(functionExtractor "oo$")
    In an equation for `bar': bar = $(functionExtractor "oo$")

This is caused by relying on System.IO.readFile to infer the text-encoding, instead of explicitly setting it to utf8.
Since GHC already enforces utf8 as source file encoding, Language.Haskell.Extract should follow GHC's behaviour (at least when compiled for GHC).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant