diff --git a/beancount_reds_importers/libreader/csvreader.py b/beancount_reds_importers/libreader/csvreader.py index 92f8611..0bd11af 100644 --- a/beancount_reds_importers/libreader/csvreader.py +++ b/beancount_reds_importers/libreader/csvreader.py @@ -74,7 +74,10 @@ def initialize_reader(self, file): # print(self.header_identifier, file.head()) def deep_identify(self, file): - return re.match(self.header_identifier, file.head()) + return re.match( + self.header_identifier, + file.head(encoding=getattr(self, "file_encoding", None)), + ) def file_date(self, file): "Get the maximum date from the file." @@ -135,7 +138,7 @@ def convert_date(d): return rdr def read_raw(self, file): - return etl.fromcsv(file.name) + return etl.fromcsv(file.name, encoding=getattr(self, "file_encoding", None)) def skip_until_main_table(self, rdr, col_labels=None): """Skip csv lines until the header line is found.""" diff --git a/beancount_reds_importers/libtransactionbuilder/investments.py b/beancount_reds_importers/libtransactionbuilder/investments.py index 2bab989..d089e06 100644 --- a/beancount_reds_importers/libtransactionbuilder/investments.py +++ b/beancount_reds_importers/libtransactionbuilder/investments.py @@ -258,9 +258,9 @@ def generate_trade_entry(self, ot, file, counter): if "sell" in ot.type: units = -1 * abs(ot.units) if not is_money_market: - metadata[ - "todo" - ] = "TODO: this entry is incomplete until lots are selected (bean-doctor context )" # noqa: E501 + metadata["todo"] = ( + "TODO: this entry is incomplete until lots are selected (bean-doctor context )" # noqa: E501 + ) if ot.type in [ "reinvest" ]: # dividends are booked to commodity_leaf. Eg: Income:Dividends:HOOLI