brittany
brittany copied to clipboard
Valid source file is rejected as containing invalid characters
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)
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)
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"