oTnTh · GitHub

Text encoding

Data files containing non-ascii characters must use UTF-8 encoding. An optional byte order mark (BOM) is allowed, at the beginning of the file (only).

According to the documentation, data files must be encoded in UTF-8. However, it might be incorrect for Windows systems.

In Windows, the default code page depends on the system language.

For example, in a Simplified Chinese version of Windows, the default code page is CP936, aka GBK encoding.

When a user tries to access a UTF-8 encoded journal file in Simplified Chinese Windows, they may encounter the following error:

R:\>chcp
Active code page: 936
R:\>hledger bal -f gbk.journal
                  97  assets:cash
                -100  equity:start
                   3  expense:食物
--------------------
                   0
R:\>hledger bal -f utf-8.journal
hledger: R:\utf-8.journal: hGetContents: invalid argument (cannot decode byte sequence starting from 144)

Note: 食物 => food

I agree that enforcing UTF-8 encoding is a good idea.

journal-files.zip

Read the original on github.com ↗