-
-
Notifications
You must be signed in to change notification settings - Fork 322
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
Nix Hledger and GHC using ascii to read hledger file. Should be using utf8 proposal for documentation #2089
Comments
Thanks for the report and doc suggestion! Is this the same or separate from #1033, which we currently show in the fine print at https://hledger.org/install.html#other ? |
I thing that it might correspond to your second point here: #1033 (comment) |
I just tested on a Debian 12 install without Nix, using Ghcup for GHC, and with Hledger installed via Cabal. I added a Euro character € to a hledger.journal file and there were no byte docoding issure running hledger bs. |
@alexiscott, thank you! So your "Proposed documentation update in manual" above still stands ? |
Hi @simonmichael , Sorry about the delay. I tested today on NixOS 23.05 and UTF8 currency also not an issue. I will test again with Ubuntu and Nix package manager (not NixOS) and a Nix version of GCC and report back here. |
Hi @simonmichael , yes this still holds for Nix (Not NixOS) on Ubuntu 23.04. Tested with VirtualBox. |
Thank you very much, I have added your text to https://hledger.org/dev/hledger.html#troubleshooting and linked that at https://hledger.org/install.html#other . |
Hello, I'm still getting this kind of error (I'm on NixOS). My setup looks like it should work given what I read in the linked comments (but maybe I missed something? In that case, sorry for the noise!):
yields
Also, the locale archive should have that locale:
yields
and
yields
But still
yields
Any suggestions as to what I'm doing wrong? I'm using |
My guess: the CSV is not valid UTF-8. What are bytes 250 through 260? Or check if you have the same problem on another system with the same CSV and |
Thank you! The file was indeed not valid UTF-8, my bad. Sorry for the noise! |
Using linux-x86_64 with a fresh install of Ubuntu Lunar 23.04.
GHC 9.4.6 installed via the Nix package manager.
Hledger also installed via Nix, at 1.30.1.
Problem
Running hledger bs on a file containing € characters:
hGetContents: invalid argument (cannot decode byte sequence starting from 226)
Solution
€ is a utf8 character and so should be treated as
utf8
notascii
.My solution, based on Nix issue NixOS/nixpkgs#64603 and Nix documentation https://nixos.org/manual/nixpkgs/stable/#locales was to update my
~.profile
with:export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive
And restart computer, or
> source ~/.profile
After that
hledger bs
was correctly reporting my balance.Proposed documentation update in manual
In the manual, it might be worth adding this Nix specific case:
If you are using Nix (not NixOS) for GHC and Hledger, you might need to set the LOCALE_ARCHIVE variable
$ echo "export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive" >>~/.profile
# close and re-open terminal window
Which could go underneath where you currently have:
$ echo "export LANG=en_US.utf8" >>~/.profile
# close and re-open terminal window
The text was updated successfully, but these errors were encountered: