-
Notifications
You must be signed in to change notification settings - Fork 93
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
buildAndWatch fails because of locale / invalid byte sequence #249
Comments
Thanks for the detailed error report! I'll take a look at this. Frankly, I've had too many headaches from locale settings with Haskell + Nix—on another project I ended up rewriting my Haskell code to always use UTF-8 regardless of the locale settings, so I'll try that here too. Not sure whether the same approach will work with Hakyll though. |
Sounds reasonable. I think as long as there is this line (and maybe the others), passing an environment value from the outside is not possible as workaround. Line 15 in 0a374cc
Btw. dropping this line would make the project work with my system. Maybe |
This change makes sure that the site executable *always* expects UTF-8, regardless of any locale environment variables. This should avoid problems like #29 and #249 in a more robust way than trying to set the right environment variables in `buildAndWatch` or `shell.nix`. The diff ended up a bit noisy because of indentation changes; the key change was adding `Encoding.setLocaleEncoding Encoding.utf8` to the beginning of `main`. I tested this by reproducing the Unicode error (using `nix-shell --pure`) and checking that the Haskell code change fixes the problem.
The annoying thing is that I added that line earlier because not having it was causing the same error on a different person's system :P. I hate dealing with differences in OS environments like this—so much incidental complexity, and hard to reasonably test to boot. Hopefully #255 fixes this problem for everyone uniformly. It's more correct behavior anyhow: the site builder will always be building the contents of this repo, which are always in UTF-8, so that would be the right behavior even on a system that was explicitly not using UTF-8 by default. (Does anybody even seriously use systems like that any more? I legitimately don't know.) |
This change makes sure that the site executable *always* expects UTF-8, regardless of any locale environment variables. This should avoid problems like #29 and #249 in a more robust way than trying to set the right environment variables in `buildAndWatch` or `shell.nix`. The diff ended up a bit noisy because of indentation changes; the key change was adding `Encoding.setLocaleEncoding Encoding.utf8` to the beginning of `main`. I tested this by reproducing the Unicode error (using `nix-shell --pure`) and checking that the Haskell code change fixes the problem.
Issue
Related
hakyll can't handle unicode? jaspervdj/hakyll#614
System
I'm using OS: Manjaro 22.0.0 Sikaris, arch based.
Nix 2.8.1 installed as package manager, but not OS.
https://wiki.archlinux.org/title/locale
Locale
The text was updated successfully, but these errors were encountered: