Fix UTF-8 issues with nix+tasty
Description
In some machines, using nix to build morley-test
and then running the executable fails with errors such as:
morley-test: <stdout>: commitBuffer: invalid argument (invalid character)
It seems this is a problem with nix (discussed here), and one solution is to set LANG=C.UTF-8
.
However, a better solution is to wrap morley-test
's main
in withUtf8
.
We should do that for all our executables.
Steps to reproduce
Prerequisites (if needed):
I'm not exactly sure of how to reproduce this behaviour on other machines, maybe setting the LANG
env variable to the same value as mine would be sufficient.
export LANG=en_GB.UTF-8
Then, build morley-client
using nix and run it:
nix-build ci.nix -A packages.cleveland.tests.morley-test
cd code/cleveland
../../result/bin/morley-test --nettest-no-run-network --xml=../../test-morley-report.xml
Expected behaviour
I expect the tests to run without throwing an exception
Actual behaviour
The executable fails with:
morley-test: <stdout>: commitBuffer: invalid argument (invalid character)
Environment
LANG=en_GB.UTF-8
- Ubuntu 20.04
Edited by Diogo Castro