jokesper
changed the title
Implement
Implement encoding for -f *.rulesencoding in .rules
simonmichael
added
A-WISH
labels
Jan 22, 2025jokesper marked this pull request as ready for review
February 1, 2025 15:39Instead of `text-icu` as [recommended by `text`](https://hackage.haskell.org/package/text-2.1.2/docs/Data-Text-Encoding.html): > To gain access to a much larger family of encodings, use the `text-icu` package. we use `encoding`, since `text-icu` requires an external library. `encoding` does require a custom setup, which is currently affected by a [bug in Cabal](haskell/cabal#6505) but it doesn't require an external runtime dependency, which makes it easier to distribute on macos and windows. I also changed the `rReadFn` to get a `Handle` rather than a `Text`. Such that we can use non standard functions for reading it. This is kind of sideways, since the one place we care about it, we don't use it at all. Though it still caused issues, since the input wasn't parseable as text. I think not using the handle has something to do with how `-` is treated as stdin but I didn't do any further tests on that, since this is out of the scope of this PR.
simonmichael pushed a commit that referenced this pull request
Feb 16, 2025…2319] Previously, hledger could read CSV files containing non-ascii characters only if they are UTF8-encoded. Now there is a new CSV rule, encoding ENCODING, which allows reading CSV files with other encodings. This adds a dependency on the encoding library, which supports fewer encodings than text-icu but does not require a third-party C library. To avoid build issues on various platforms, we require version 0.10+. This adds some use of the ImplicitParams language extension, required by encoding's API, but only in a small code region. This also changes the type of Reader's rReadFn; it now takes a `Handle` rather than a `Text`, allowing more flexibility.
Merged
Closed
Closed
Closed
Closed