brittany icon indicating copy to clipboard operation
brittany copied to clipboard

Valid source file is rejected as containing invalid characters

Open kephas opened this issue 3 years ago • 2 comments

If I use some characters in a string, including 'é' and '…', I get an error even if GHC would compile the file and produce a working executable:

$ echo '"héllo"' | brittany
<stdin>: hGetContents: invalid argument (invalid byte sequence)

kephas avatar Sep 08 '21 16:09 kephas

This may be a problem with your system locale. It works on my machine:

$ brittany --version
brittany version 0.13.1.2
Copyright (C) 2016-2019 Lennart Spitzner
Copyright (C) 2019 PRODA LTD
There is NO WARRANTY, to the extent permitted by law.

$ echo '"héllo"' | brittany
"héllo"

$ echo '"héllo"' | env LANG=C brittany
<stdin>: hGetContents: invalid argument (invalid byte sequence)

tfausak avatar Sep 08 '21 17:09 tfausak

Note sure it's a configuration issue:

pierre@viper:~$ sudo locale-gen
Generating locales (this might take a while)...
  en_GB.UTF-8... done
  fr_FR.UTF-8... done
Generation complete.
pierre@viper:~$ locale
LANG=fr_FR.UTF-8
LANGUAGE=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
pierre@viper:~$ echo '"héllo"' | brittany
<stdin>: hGetContents: invalid argument (invalid byte sequence)
pierre@viper:~$ echo '"héllo"' | env LANG=C.UTF-8 brittany
"héllo"

kephas avatar Oct 04 '21 09:10 kephas