From c51a0a4fefb6fb9e8ca088244891ad0826ba514b Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 19 Feb 2022 14:55:48 +0100 Subject: PBN charset auto-detection using chardet --- dealconvert/formats/html.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'dealconvert/formats/html.py') diff --git a/dealconvert/formats/html.py b/dealconvert/formats/html.py index 4185c40..efb16ff 100644 --- a/dealconvert/formats/html.py +++ b/dealconvert/formats/html.py @@ -1,6 +1,9 @@ from collections import OrderedDict +import sys import warnings +import chardet + from bcdd.BCalcWrapper import BCalcWrapper from bcdd.DDTable import DDTable from bcdd.Exceptions import FieldNotFoundException @@ -181,6 +184,7 @@ class HTMLFormat(BinaryFormat): def get_html_content(self, dealset): deal_rows = [] event_name = dealset[0].event + event_name = event_name.decode(chardet.detect(event_name)['encoding']) while len(dealset) > 0: deal_rows.append(dealset[0:self.deals_per_column]) dealset = dealset[self.deals_per_column:] -- cgit v1.2.3