diff --git a/src/calibre/ebooks/chardet/__init__.py b/src/calibre/ebooks/chardet/__init__.py index af6d724883..971ac9bc9a 100644 --- a/src/calibre/ebooks/chardet/__init__.py +++ b/src/calibre/ebooks/chardet/__init__.py @@ -99,7 +99,8 @@ def xml_to_unicode(raw, verbose=False, strip_encoding_pats=False, try: raw = raw.decode(encoding, 'replace') except LookupError: - raw = raw.decode('utf-8', 'replace') + encoding = 'utf-8' + raw = raw.decode(encoding, 'replace') if strip_encoding_pats: raw = strip_encoding_declarations(raw) diff --git a/src/calibre/trac/donations/server.py b/src/calibre/trac/donations/server.py index 8e7a096353..24174db801 100644 --- a/src/calibre/trac/donations/server.py +++ b/src/calibre/trac/donations/server.py @@ -196,7 +196,7 @@ class Server(object): def calculate_month_trend(self, days=31): stats = self.get_slice(date.today()-timedelta(days=days-1), date.today()) - fig = plt.figure(2, (12, 4), 96)#, facecolor, edgecolor, frameon, FigureClass) + fig = plt.figure(2, (10, 4), 96)#, facecolor, edgecolor, frameon, FigureClass) fig.clear() ax = fig.add_subplot(111) x = list(range(days-1, -1, -1)) @@ -216,7 +216,7 @@ Donors per day: %(dpd).2f ad=stats.average_deviation, dpd=len(stats.totals)/float(stats.period.days), ) - text = ax.annotate(text, (0.6, 0.65), textcoords='axes fraction') + text = ax.annotate(text, (0.5, 0.65), textcoords='axes fraction') fig.savefig(self.MONTH_TRENDS) def calculate_trend(self):