Closed artkpv closed 1 year ago
You're welcome!
I don't have a windows machine accessible at the moment, but what is the output with --debug=9 added ?
@simonmichael
With --debug=9
it is has a lot of output. It reads the chars as '\1056\1072\1089\1093\1086\1076\1099'
Here is for --debug=2
:
$ hledger.exe -f main.ledger bal Расходы --debug=2
running: "hledger 1.1"
raw args:
[ "-f"
, "main.ledger"
, "bal"
, "\1056\1072\1089\1093\1086\1076\1099"
, "--debug=2"
]
raw args rearranged for cmdargs:
[ "bal"
, "\1056\1072\1089\1093\1086\1076\1099"
, "--debug=2"
, "-f"
, "main.ledger"
]
raw command is probably: "bal"
raw args before command: [ "-f" , "main.ledger" ]
raw args after command: [ "\1056\1072\1089\1093\1086\1076\1099" , "--debug=2" ]
processed opts:
CliOpts
{ rawopts_ =
[ ( "command" , "balance" )
, ( "args" , "\1056\1072\1089\1093\1086\1076\1099" )
, ( "debug" , "2" )
, ( "file" , "main.ledger" )
]
, command_ = "balance"
, file_ = [ "main.ledger" ]
, rules_file_ = Nothing
, output_file_ = Nothing
, output_format_ = Nothing
, alias_ = []
, ignore_assertions_ = False
, debug_ = 2
, no_new_accounts_ = False
, width_ = Nothing
, available_width_ = 80
, reportopts_ =
ReportOpts
{ period_ = PeriodAll
, interval_ = NoInterval
, clearedstatus_ = Nothing
, cost_ = False
, depth_ = Nothing
, display_ = Nothing
, date2_ = False
, empty_ = False
, no_elide_ = False
, real_ = False
, format_ = Nothing
, query_ = "\1056\1072\1089\1093\1086\1076\1099"
, average_ = False
, related_ = False
, balancetype_ = PeriodChange
, accountlistmode_ = ALDefault
, drop_ = 0
, row_total_ = False
, no_total_ = False
, value_ = False
}
}
command matched: "balance"
isNullCommand: False
isInternalCommand: True
isExternalCommand: False
isBadCommand: False
period from opts: PeriodAll
interval from opts: NoInterval
query from opts & args: Acct "\1056\1072\1089\1093\1086\1076\1099"
trying reader: "journal"
reader result: "Journal H:\\accounting\\main.ledger with 1283 transactions, 70 accounts"
balanceReport accts: []
balanceReport items: []
balanceReport total: 0
--------------------
0
Also for this, when '-' used, it gets the report.
$ hledger.exe -f main.ledger bal -
р 219,709.000 Расходы:название - другое
--------------------
р 219,709.000
That debug output is all as it should be. What about the example in https://github.com/simonmichael/hledger/blob/master/tests/i18n/unicode-account-matching.test#L3-L5 (extract it to a file and run hledger -f - register τράπ --debug 9
) ?
@simonmichael Prints nothing:
$ hledger -f test.ledger register τράπ --debug=9
running: "hledger 1.1"
raw args:
[ "-f"
, "test.ledger"
, "register"
, "\964\961\940\960"
, "--debug=9"
]
raw args rearranged for cmdargs:
[ "register"
, "\964\961\940\960"
, "--debug=9"
, "-f"
, "test.ledger"
]
raw command is probably: "register"
raw args before command: [ "-f" , "test.ledger" ]
raw args after command: [ "\964\961\940\960" , "--debug=9" ]
processed opts:
CliOpts
{ rawopts_ =
[ ( "command" , "register" )
, ( "args" , "\964\961\940\960" )
, ( "debug" , "9" )
, ( "file" , "test.ledger" )
]
, command_ = "register"
, file_ = [ "test.ledger" ]
, rules_file_ = Nothing
, output_file_ = Nothing
, output_format_ = Nothing
, alias_ = []
, ignore_assertions_ = False
, debug_ = 9
, no_new_accounts_ = False
, width_ = Nothing
, available_width_ = 80
, reportopts_ =
ReportOpts
{ period_ = PeriodAll
, interval_ = NoInterval
, clearedstatus_ = Nothing
, cost_ = False
, depth_ = Nothing
, display_ = Nothing
, date2_ = False
, empty_ = False
, no_elide_ = False
, real_ = False
, format_ = Nothing
, query_ = "\964\961\940\960"
, average_ = False
, related_ = False
, balancetype_ = PeriodChange
, accountlistmode_ = ALDefault
, drop_ = 0
, row_total_ = False
, no_total_ = False
, value_ = False
}
}
command matched: "register"
isNullCommand: False
isInternalCommand: True
isExternalCommand: False
isBadCommand: False
period from opts: PeriodAll
interval from opts: NoInterval
query from opts & args: Acct "\964\961\940\960"
trying reader: "journal"
numberp parsed: ( "" , [ "10" ] )
numberp quantity,precision,mdecimalpoint,mgrps: ( 10.0 , 0 , Nothing , Nothing )
journalChooseCommmodityStyles using amounts: [Amount {acommodity="\9572\1040\9572\1043\9576\9618", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Nothing, asdigitgroups = Nothing}},Amount {acommodity="AUTO", aquantity=0, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
reader result: "Journal H:\\accounting\\test.ledger with 1 transactions, 2 accounts: [\"\\1088\\1076\\1080\\1088\\1076\\1061\\1088\\1076\\1078\",\"\\9575\\1044\\9575\\1041\\9580\\1084\\9575\\1040\\9580\\9569\\9580\\9570\\9580\\9618\"], commodity styles: fromList [(\"AUTO\",AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}),(\"\\9572\\1040\\9572\\1043\\9576\\9618\",AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing})]"
requestedspan: DateSpan -
journalspan: DateSpan 2009/01/01
requestedspanclosed: DateSpan 2009/01/01
intervalspans: [DateSpan 2009/01/01]
reportstart: Just 2009 (-01) (-01)
reportend: Just 2009 (-01) (-02)
reportspan: DateSpan 2009/01/01
q: Acct "\964\961\940\960"
dateq: Any
beforeandduringq: And ([Acct "\964\961\940\960",Date (DateSpan -2009/01/01)])
ps1: []
ps2: []
ps3: []
ps4: []
beforeps, duringps: ( [] , [] )
postingsReport items: []
Here (OSX) the output is:
$ hledger-1.1 -f test.hledger register τράπ --debug 9
running: "hledger 1.1"
raw args:
[ "-f"
, "test.hledger"
, "register"
, "\964\961\940\960"
, "--debug"
, "9"
]
raw args rearranged for cmdargs:
[ "register"
, "\964\961\940\960"
, "--debug"
, "9"
, "-f"
, "test.hledger"
]
raw command is probably: "register"
raw args before command: [ "-f" , "test.hledger" ]
raw args after command: [ "\964\961\940\960" , "--debug" , "9" ]
processed opts:
CliOpts
{ rawopts_ =
[ ( "command" , "register" )
, ( "args" , "\964\961\940\960" )
, ( "debug" , "9" )
, ( "file" , "test.hledger" )
]
, command_ = "register"
, file_ = [ "test.hledger" ]
, rules_file_ = Nothing
, output_file_ = Nothing
, output_format_ = Nothing
, alias_ = []
, ignore_assertions_ = False
, debug_ = 9
, no_new_accounts_ = False
, width_ = Nothing
, available_width_ = 80
, reportopts_ =
ReportOpts
{ period_ = PeriodAll
, interval_ = NoInterval
, clearedstatus_ = Nothing
, cost_ = False
, depth_ = Nothing
, display_ = Nothing
, date2_ = False
, empty_ = False
, no_elide_ = False
, real_ = False
, format_ = Nothing
, query_ = "\964\961\940\960"
, average_ = False
, related_ = False
, balancetype_ = PeriodChange
, accountlistmode_ = ALDefault
, drop_ = 0
, row_total_ = False
, no_total_ = False
, value_ = False
}
}
command matched: "register"
isNullCommand: False
isInternalCommand: True
isExternalCommand: False
isBadCommand: False
period from opts: PeriodAll
interval from opts: NoInterval
query from opts & args: Acct "\964\961\940\960"
trying reader: "journal"
numberp parsed: ( "" , [ "10" ] )
numberp quantity,precision,mdecimalpoint,mgrps: ( 10.0 , 0 , Nothing , Nothing )
journalChooseCommmodityStyles using amounts: [Amount {acommodity="\1088\1091\1073", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Nothing, asdigitgroups = Nothing}},Amount {acommodity="AUTO", aquantity=0, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
reader result: "Journal /Users/simon/src/hledger/test.hledger with 1 transactions, 2 accounts: [\"\\964\\961\\940\\960\\949\\950\\945\",\"\\2344\\2325\\2342\"], commodity styles: fromList [(\"AUTO\",AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}),(\"\\1088\\1091\\1073\",AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing})]"
requestedspan: DateSpan -
journalspan: DateSpan 2009/01/01
requestedspanclosed: DateSpan 2009/01/01
intervalspans: [DateSpan 2009/01/01]
reportstart: Just 2009 (-01) (-01)
reportend: Just 2009 (-01) (-02)
reportspan: DateSpan 2009/01/01
q: Acct "\964\961\940\960"
dateq: Any
beforeandduringq: And ([Acct "\964\961\940\960",Date (DateSpan -2009/01/01)])
ps1:
[2009-01-01 τράπεζα 10 руб ;
]
ps2:
[2009-01-01 τράπεζα 10 руб ;
]
symq: Any
ps3:
[2009-01-01 τράπεζα 10 руб ;
]
ps4:
[2009-01-01 τράπεζα 10 руб ;
]
beforestartq: Date (DateSpan -2008/12/31)
beforeps, duringps:
([],[2009-01-01 τράπεζα 10 руб ;
])
postingsReport items:
[(Just 2009-01-01,Nothing,Just "\1087\1088\1086\1074\1077\1088\1082\1072",2009-01-01 τράπεζα 10 руб ;
,Mixed [Amount {acommodity="\1088\1091\1073", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}])]
2009/01/01 проверка τράπεζα 10 руб 10 руб
Yours is parsing the command line correctly, but not the journal file. Eg руб
is parsed as "\9572\1040\9572\1043\9576\9618"
when it should be "\1088\1091\1073"
.
How did you install this hledger ? Built it yourself in this same Cygwin environment, or downloaded an exe... ?
@simonmichael Thank you for your quick answers! Downloaded exe. Not in cygwin. At first I've installed Haskell Platform, then uninstalled it and followed steps at http://hledger.org/download.html using Powershell. It looks I better reinstall it to use under cygwin
Yes probably that will solve it. The exes which used to be linked from /download were non-cygwin builds created by https://github.com/simonmichael/hledger/blob/master/appveyor.yml. If we ever link those again, there should be a note about this issue.
@simonmichael
I run git clone
and stack install
in the dir, in Cygwin under Administrator. While stack and GHC already installed (not cygwin). It broke with:
-- While building package iproute-1.7.1 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack-work\dist\ca59d0ab register
Process exited with code: ExitFailure 1
Logs have been written to: C:\cygwin64\home\USERNAME\hledger\.stack-work\logs\iproute-1.7.1.log
Configuring iproute-1.7.1...
Building iproute-1.7.1...
Preprocessing library iproute-1.7.1...
[1 of 8] Compiling Data.IP.Addr ( Data\IP\Addr.hs, .stack-work\dist\ca59d0ab\build\Data\IP\Addr.o )
[2 of 8] Compiling Data.IP.Mask ( Data\IP\Mask.hs, .stack-work\dist\ca59d0ab\build\Data\IP\Mask.o )
[3 of 8] Compiling Data.IP.Range ( Data\IP\Range.hs, .stack-work\dist\ca59d0ab\build\Data\IP\Range.o )
[4 of 8] Compiling Data.IP.Internal ( Data\IP\Internal.hs, .stack-work\dist\ca59d0ab\build\Data\IP\Internal.o )
[5 of 8] Compiling Data.IP.Op ( Data\IP\Op.hs, .stack-work\dist\ca59d0ab\build\Data\IP\Op.o )
[6 of 8] Compiling Data.IP.RouteTable.Internal ( Data\IP\RouteTable\Internal.hs, .stack-work\dist\ca59d0ab\build\Data\IP\RouteTable\Internal.o )
[7 of 8] Compiling Data.IP.RouteTable ( Data\IP\RouteTable.hs, .stack-work\dist\ca59d0ab\build\Data\IP\RouteTable.o )
[8 of 8] Compiling Data.IP ( Data\IP.hs, .stack-work\dist\ca59d0ab\build\Data\IP.o )
Installing library in
C:\sr\snapshots\00b1a84f\lib\x86_64-windows-ghc-8.0.2\iproute-1.7.1-1VmXzmOljuk9tg4pg6dAZJ
Registering iproute-1.7.1...
Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe:
'C:\Users\USERNAME\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\bin\ghc-pkg.EXE'
exited with an error:
iproute-1.7.1: Warning: haddock-interfaces:
C:\sr\snapshots\00b1a84f\doc\iproute-1.7.1\iproute.haddock doesn't exist or
isn't a file
ghc-pkg.EXE: C:\sr\snapshots\00b1a84f\pkgdb\package.cache: you don't have
permission to modify this file
Not familiar with this. Thanks for any help or any hints/links. Trying again later.
This looks like https://github.com/commercialhaskell/stack/issues/2617 https://github.com/commercialhaskell/stack/issues/2617, a known problem with stack/ghc on windows. Until GHC 8.2 the workaround seems to be try it again until it succeeds or add -j1.
@simonmichael What am I doing wrong here? I've run stack install hledger-lib hledger
without errors eventually. It now works under powershell. Unicode is used for filtration. But under Cygwin it doesn't.
Under Cygwin:
USERNAME@USERNAME-pc /cygdrive/h/accounting
$ which hledger
/cygdrive/c/Users/USERNAME/AppData/Roaming/local/bin/hledger
USERNAME@USERNAME-pc /cygdrive/h/accounting
$ hledger --version
hledger 1.2
USERNAME@USERNAME-pc /cygdrive/h/accounting
$ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_ALL=
USERNAME@USERNAME-pc /cygdrive/h/accounting
$ hledger -f test.ledger bal τράπ --debug=9
running: "hledger 1.2"
raw args: [ "-f" , "test.ledger" , "bal" , "\964\961\940\960" , "--debug=9" ]
...
journalChooseCommmodityStyles using amounts: [Amount {acommodity="\9572\1040\9572\1043\9576\9618", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Nothing, asdigitgroups = Nothing}},Amount {acommodity="AUTO", aquantity=0, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
reader result: "Journal H:\\accounting\\test.ledger with 1 transactions, 2 accounts: [\"\\1088\\1076\\1080\\1088\\1076\\1061\\1088\\1076\\1078\",\"\\9575\\1044\\9575\\1041\\9580\\1084\\9575\\1040\\9580\\9569\\9580\\9570\\9580\\9618\"], commodity styles: fromList [(\"AUTO\",AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}),(\"\\9572\\1040\\9572\\1043\\9576\\9618\",AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing})]"
balanceReport accts: []
balanceReport items: []
balanceReport total: Mixed [Amount {acommodity="", aquantity=0, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
--------------------
0
Under Powershell:
> chcp
Active code page: 65001
H:\accounting [master +1 ~1 -0 !]
> gcm hledger
CommandType Name Version Source
----------- ---- ------- ------
Application hledger.exe 0.0.0.0 C:\Users\USERNAME\AppData\Roaming\local\bin\hledger.exe
H:\accounting [master +1 ~1 -0 !]
> hledger.exe -f .\test.ledger bal τράπ --debug=9
running: "hledger 1.2"
raw args:
[ "-f"
, ".\\test.ledger"
, "bal"
, "\964\961\940\960"
, "--debug=9"
]
...
journalChooseCommmodityStyles using amounts: [Amount {acommodity="\1088\1091\1073", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Nothing, asdigitgroups = Nothing}},Amount {acommodity="AUTO", aquantity=0, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
reader result: "Journal H:\\accounting\\.\\test.ledger with 1 transactions, 2 accounts: [\"\\964\\961\\940\\960\\949\\950\\945\",\"\\2344\\2325\\2342\"], commodity styles: fromList [(\"AUTO\",AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}),(\"\\1088\\1091\\1073\",AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing})]"
balanceReport accts:
[ Account
Ï„Ïάπεζα
( boring : n
, postings : 1
, ebalance : 10 руб
, ibalance : 10 руб
)
]
balanceReport items: [("\964\961\940\960\949\950\945","\964\961\940\960\949\950\945",0,Mixed [Amount {acommodity="\1088\1091\1073", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}])]
10 руб τράπεζα
--------------------
balanceReport total: Mixed [Amount {acommodity="\1088\1091\1073", aquantity=10.0, aprice=, astyle=AmountStyle {ascommodityside = R, ascommodityspaced = True, asprecision = 0, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
10 руб
This is a binary you built in the cygwin environment, right ?
Sorry, but I don't have enough cygwin/windows expertise to know the answer. Is there a cygwin development community you can ask ?
(MOVED TO #545)
Thanks for the report. Can you open this as a separate issue, and I'll reply there.
@simonmichael Moved
I have lost track of what's going here. I think filtering via non-ascii command-line argument wasn't working for a non-cygwin build in a cygwin shell, or vice versa. @w1ld could you summarise the latest status ? Any progress ?
@simonmichael Thank you for your interest in fixing it. Lost track also. I think we can close it so far. I'll reinstall hledger and test again next.
The point is hledger does not work with Unicode symbols in my installation under Cygwin. Now it works under Powershell (see below). But does not work under Cygwin.
Cygwin:
$ cat test.ledger
2009-01-01 проверка
τράπεζα 10 руб
नकद
$ hledger -f test.ledger register τράπ
$ # no output above
$ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_ALL=
$ which hledger
/cygdrive/c/Users/[USERNAME]/AppData/Roaming/local/bin/hledger
Powershell:
> hledger -f test.ledger register τράπ
H:\accounting [master +0 ~2 -0 !]
> chcp
Active code page: 866
H:\accounting [master +0 ~2 -0 !]
> chcp 65001
Active code page: 65001
H:\accounting [master +0 ~2 -0 !]
> hledger -f test.ledger register τράπ
2009/01/01 проверка τράπεζα 10 руб 10 руб
H:\accounting [master +0 ~2 -0 !]
> cat .\test.ledger
2009-01-01 проверка
П„ПЃО¬ПЂОµО¶О± 10 СЂСѓР±
नकद
H:\accounting [master +0 ~2 -0 !]
> hledger.exe --version
hledger 1.2
> gcm hledger.exe | select source
Source
------
C:\Users\[USERNAME]\AppData\Roaming\local\bin\hledger.exe
I think the remaining action for this is to document somewhere that non-cygwin builds like the ones at http://hledger.org/download.html may have this kind of issue when run in cygwin, and perhaps vice versa.
The install page mentions this at https://hledger.org/install.html#known-build-issues, closing.
Hi, Thank you for the great tool!
How can I fix this to make hledger filter bal report using cyrillic charaters?
$ hledger.exe -f main.ledger bal Расходы
Outputs: