Valid source file is rejected as containing invalid characters #354

Open
opened 2021-09-08 18:24:30 +02:00 by kephas · 2 comments
kephas commented 2021-09-08 18:24:30 +02:00 (Migrated from github.com)

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)
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: ```console $ echo '"héllo"' | brittany <stdin>: hGetContents: invalid argument (invalid byte sequence) ```
tfausak commented 2021-09-08 19:36:16 +02:00 (Migrated from github.com)

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)
This may be a problem with your system locale. It works on my machine: ``` sh $ 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 commented 2021-10-04 11:20:16 +02:00 (Migrated from github.com)

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"
Note sure it's a configuration issue: ```shell 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 in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#354
There is no content yet.