i18n: always read and write UTF-8, ignoring current locale (#34)
Also remove a bunch of CPP conditions. Uses the GHC-version-independent UTF-8 layer from pandoc.
This commit is contained in:
parent
ce4347a2be
commit
6a845eb5e4
@ -17,15 +17,13 @@ import Data.List
|
|||||||
import Safe (readDef)
|
import Safe (readDef)
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Exit (exitFailure)
|
import System.Exit (exitFailure)
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr, putStrLn)
|
|
||||||
import System.IO.UTF8 (putStr, putStrLn)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
import Hledger.Cli.Utils (withJournalDo)
|
import Hledger.Cli.Utils (withJournalDo)
|
||||||
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
|
import Prelude hiding (putStr, putStrLn)
|
||||||
|
import Hledger.Data.UTF8 (putStr, putStrLn)
|
||||||
|
|
||||||
|
|
||||||
progname_chart = progname_cli ++ "-chart"
|
progname_chart = progname_cli ++ "-chart"
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
The Hledger.Data library allows parsing and querying of C++ ledger-style
|
The Hledger.Data library allows parsing and querying of C++ ledger-style
|
||||||
journal files. It generally provides a compatible subset of C++ ledger's
|
journal files. It generally provides a compatible subset of C++ ledger's
|
||||||
functionality. This package re-exports all the Hledger.Data.* modules.
|
functionality. This package re-exports all the Hledger.Data.* modules
|
||||||
|
(except UTF8, which requires an explicit import.)
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ module Data.Time.Calendar,
|
|||||||
module Data.Time.LocalTime,
|
module Data.Time.LocalTime,
|
||||||
module Debug.Trace,
|
module Debug.Trace,
|
||||||
module Hledger.Data.Utils,
|
module Hledger.Data.Utils,
|
||||||
|
-- module Hledger.Data.UTF8,
|
||||||
module Text.Printf,
|
module Text.Printf,
|
||||||
module Text.RegexPR,
|
module Text.RegexPR,
|
||||||
module Test.HUnit,
|
module Test.HUnit,
|
||||||
@ -36,10 +37,9 @@ import Data.Time.Clock
|
|||||||
import Data.Time.Calendar
|
import Data.Time.Calendar
|
||||||
import Data.Time.LocalTime
|
import Data.Time.LocalTime
|
||||||
import Debug.Trace
|
import Debug.Trace
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
-- needs to be done in each module I think
|
||||||
import Prelude hiding (readFile,putStr,print)
|
-- import Prelude hiding (readFile,writeFile,getContents,putStr,putStrLn)
|
||||||
import System.IO.UTF8
|
-- import Hledger.Data.UTF8
|
||||||
#endif
|
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
import Text.RegexPR
|
import Text.RegexPR
|
||||||
|
|||||||
@ -16,13 +16,6 @@ module Hledger.Read (
|
|||||||
myTimelog,
|
myTimelog,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
import Hledger.Data.Dates (getCurrentDay)
|
|
||||||
import Hledger.Data.Types (Journal(..), Reader(..))
|
|
||||||
import Hledger.Data.Journal (nullctx)
|
|
||||||
import Hledger.Data.Utils
|
|
||||||
import Hledger.Read.JournalReader as JournalReader
|
|
||||||
import Hledger.Read.TimelogReader as TimelogReader
|
|
||||||
|
|
||||||
import Control.Monad.Error
|
import Control.Monad.Error
|
||||||
import Data.Either (partitionEithers)
|
import Data.Either (partitionEithers)
|
||||||
import Safe (headDef)
|
import Safe (headDef)
|
||||||
@ -30,12 +23,15 @@ import System.Directory (doesFileExist, getHomeDirectory)
|
|||||||
import System.Environment (getEnv)
|
import System.Environment (getEnv)
|
||||||
import System.FilePath ((</>))
|
import System.FilePath ((</>))
|
||||||
import System.IO (IOMode(..), withFile, stderr)
|
import System.IO (IOMode(..), withFile, stderr)
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
|
import Hledger.Data.Dates (getCurrentDay)
|
||||||
|
import Hledger.Data.Types (Journal(..), Reader(..))
|
||||||
|
import Hledger.Data.Journal (nullctx)
|
||||||
|
import Hledger.Data.Utils
|
||||||
import Prelude hiding (getContents)
|
import Prelude hiding (getContents)
|
||||||
import System.IO.UTF8 (getContents, hGetContents)
|
import Hledger.Data.UTF8 (getContents, hGetContents)
|
||||||
#else
|
import Hledger.Read.JournalReader as JournalReader
|
||||||
import System.IO (hGetContents)
|
import Hledger.Read.TimelogReader as TimelogReader
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
journalenvvar = "LEDGER_FILE"
|
journalenvvar = "LEDGER_FILE"
|
||||||
|
|||||||
@ -121,12 +121,10 @@ import Control.Monad.Error (ErrorT(..), throwError, catchError)
|
|||||||
import Data.List.Split (wordsBy)
|
import Data.List.Split (wordsBy)
|
||||||
import Safe (headDef)
|
import Safe (headDef)
|
||||||
import Text.ParserCombinators.Parsec hiding (parse)
|
import Text.ParserCombinators.Parsec hiding (parse)
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (readFile, putStr, putStrLn, print, getContents)
|
|
||||||
import System.IO.UTF8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
|
import Prelude hiding (readFile)
|
||||||
|
import Hledger.Data.UTF8 (readFile)
|
||||||
import Hledger.Read.Utils
|
import Hledger.Read.Utils
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,12 +42,14 @@ library
|
|||||||
Hledger.Data.TimeLog
|
Hledger.Data.TimeLog
|
||||||
Hledger.Data.Types
|
Hledger.Data.Types
|
||||||
Hledger.Data.Utils
|
Hledger.Data.Utils
|
||||||
|
Hledger.Data.UTF8
|
||||||
Hledger.Read
|
Hledger.Read
|
||||||
Hledger.Read.Utils
|
Hledger.Read.Utils
|
||||||
Hledger.Read.JournalReader
|
Hledger.Read.JournalReader
|
||||||
Hledger.Read.TimelogReader
|
Hledger.Read.TimelogReader
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
base >= 3 && < 5
|
base >= 3 && < 5
|
||||||
|
,bytestring
|
||||||
,containers
|
,containers
|
||||||
,directory
|
,directory
|
||||||
,filepath
|
,filepath
|
||||||
|
|||||||
@ -7,10 +7,6 @@ Released under GPL version 3 or later.
|
|||||||
|
|
||||||
module Hledger.Vty.Main where
|
module Hledger.Vty.Main where
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr, putStrLn)
|
|
||||||
import System.IO.UTF8 (putStr, putStrLn)
|
|
||||||
#endif
|
|
||||||
import Graphics.Vty
|
import Graphics.Vty
|
||||||
import Safe (headDef)
|
import Safe (headDef)
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
@ -22,6 +18,8 @@ import Hledger.Cli.Register
|
|||||||
import Hledger.Cli.Utils (withJournalDo)
|
import Hledger.Cli.Utils (withJournalDo)
|
||||||
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
|
import Prelude hiding (putStr, putStrLn)
|
||||||
|
import Hledger.Data.UTF8 (putStr, putStrLn)
|
||||||
|
|
||||||
|
|
||||||
progname_vty = progname_cli ++ "-vty"
|
progname_vty = progname_cli ++ "-vty"
|
||||||
|
|||||||
@ -7,10 +7,6 @@ Released under GPL version 3 or later.
|
|||||||
|
|
||||||
module Hledger.Web.Main where
|
module Hledger.Web.Main where
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr, putStrLn)
|
|
||||||
import System.IO.UTF8 (putStr, putStrLn)
|
|
||||||
#endif
|
|
||||||
import Control.Concurrent (forkIO, threadDelay)
|
import Control.Concurrent (forkIO, threadDelay)
|
||||||
import Network.Wai.Handler.SimpleServer (run)
|
import Network.Wai.Handler.SimpleServer (run)
|
||||||
import System.Exit (exitFailure)
|
import System.Exit (exitFailure)
|
||||||
@ -23,6 +19,8 @@ import Hledger.Cli.Options
|
|||||||
import Hledger.Cli.Utils (withJournalDo, openBrowserOn)
|
import Hledger.Cli.Utils (withJournalDo, openBrowserOn)
|
||||||
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
import Hledger.Cli.Version (progversionstr, binaryfilename)
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
|
import Prelude hiding (putStr, putStrLn)
|
||||||
|
import Hledger.Data.UTF8 (putStr, putStrLn)
|
||||||
import Hledger.Web.App (App(..), withApp)
|
import Hledger.Web.App (App(..), withApp)
|
||||||
import Hledger.Web.Files (createFilesIfMissing)
|
import Hledger.Web.Files (createFilesIfMissing)
|
||||||
import Hledger.Web.Settings (browserstartdelay, defhost, defport, datadir)
|
import Hledger.Web.Settings (browserstartdelay, defhost, defport, datadir)
|
||||||
|
|||||||
@ -15,13 +15,10 @@ import Hledger.Data
|
|||||||
import Hledger.Read.JournalReader (someamount)
|
import Hledger.Read.JournalReader (someamount)
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
import Hledger.Cli.Register (registerReport, registerReportAsText)
|
import Hledger.Cli.Register (registerReport, registerReportAsText)
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
import Prelude hiding (putStr, putStrLn, appendFile)
|
||||||
import Prelude hiding (putStr, putStrLn, getLine, appendFile)
|
import Hledger.Data.UTF8 (putStr, putStrLn, appendFile)
|
||||||
import System.IO.UTF8
|
|
||||||
import System.IO ( stderr )
|
|
||||||
#else
|
|
||||||
import System.IO ( stderr, hPutStrLn, hPutStr )
|
import System.IO ( stderr, hPutStrLn, hPutStr )
|
||||||
#endif
|
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
import Hledger.Cli.Utils (readJournalWithOpts)
|
import Hledger.Cli.Utils (readJournalWithOpts)
|
||||||
|
|||||||
@ -111,10 +111,8 @@ import Hledger.Data.AccountName
|
|||||||
import Hledger.Data.Posting
|
import Hledger.Data.Posting
|
||||||
import Hledger.Data.Ledger
|
import Hledger.Data.Ledger
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr)
|
import Prelude hiding (putStr)
|
||||||
import System.IO.UTF8
|
import Hledger.Data.UTF8 (putStr)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
-- | A balance report is a chart of accounts with balances, and their grand total.
|
-- | A balance report is a chart of accounts with balances, and their grand total.
|
||||||
|
|||||||
@ -9,10 +9,8 @@ module Hledger.Cli.Histogram
|
|||||||
where
|
where
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr)
|
import Prelude hiding (putStr)
|
||||||
import System.IO.UTF8
|
import Hledger.Data.UTF8 (putStr)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
barchar = '*'
|
barchar = '*'
|
||||||
|
|||||||
@ -39,11 +39,8 @@ See "Hledger.Data.Ledger" for more examples.
|
|||||||
|
|
||||||
module Hledger.Cli.Main where
|
module Hledger.Cli.Main where
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding (putStr, putStrLn)
|
import Prelude hiding (putStr, putStrLn)
|
||||||
import System.IO.UTF8
|
import Hledger.Data.UTF8 (putStr, putStrLn)
|
||||||
#endif
|
|
||||||
|
|
||||||
import Hledger.Data
|
import Hledger.Data
|
||||||
import Hledger.Cli.Commands
|
import Hledger.Cli.Commands
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
|
|||||||
@ -12,12 +12,10 @@ module Hledger.Cli.Print (
|
|||||||
,journalReport
|
,journalReport
|
||||||
,showTransactions
|
,showTransactions
|
||||||
) where
|
) where
|
||||||
import Hledger.Data
|
|
||||||
import Hledger.Cli.Options
|
import Hledger.Cli.Options
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
import Hledger.Data
|
||||||
import Prelude hiding (putStr)
|
import Prelude hiding (putStr)
|
||||||
import System.IO.UTF8
|
import Hledger.Data.UTF8 (putStr)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
-- | A "journal report" is just a list of transactions.
|
-- | A "journal report" is just a list of transactions.
|
||||||
|
|||||||
@ -16,14 +16,13 @@ module Hledger.Cli.Register (
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Safe (headMay, lastMay)
|
import Safe (headMay, lastMay)
|
||||||
import Hledger.Data
|
|
||||||
import Hledger.Cli.Options
|
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
import Prelude hiding ( putStr )
|
|
||||||
import System.IO.UTF8
|
|
||||||
#endif
|
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
|
|
||||||
|
import Hledger.Cli.Options
|
||||||
|
import Hledger.Data
|
||||||
|
import Prelude hiding (putStr)
|
||||||
|
import Hledger.Data.UTF8 (putStr)
|
||||||
|
|
||||||
|
|
||||||
-- | A register report is a list of postings to an account or set of
|
-- | A register report is a list of postings to an account or set of
|
||||||
-- accounts, with a running total. Postings may be actual postings, or
|
-- accounts, with a running total. Postings may be actual postings, or
|
||||||
|
|||||||
@ -7,13 +7,12 @@ Print some statistics for the journal.
|
|||||||
|
|
||||||
module Hledger.Cli.Stats
|
module Hledger.Cli.Stats
|
||||||
where
|
where
|
||||||
import Hledger.Data
|
|
||||||
import Hledger.Cli.Options
|
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
#if __GLASGOW_HASKELL__ <= 610
|
|
||||||
|
import Hledger.Cli.Options
|
||||||
|
import Hledger.Data
|
||||||
import Prelude hiding (putStr)
|
import Prelude hiding (putStr)
|
||||||
import System.IO.UTF8
|
import Hledger.Data.UTF8 (putStr)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
-- like Register.summarisePostings
|
-- like Register.summarisePostings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user