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

Valid source file is rejected as containing invalid characters #354

Open
kephas opened this issue Sep 8, 2021 · 2 comments
Open

Valid source file is rejected as containing invalid characters #354

kephas opened this issue Sep 8, 2021 · 2 comments

Comments

@kephas
Copy link

kephas commented Sep 8, 2021

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)
@tfausak
Copy link
Collaborator

tfausak commented Sep 8, 2021

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)

@kephas
Copy link
Author

kephas commented Oct 4, 2021

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"

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

No branches or pull requests

2 participants