From b5ec6cc320384d0501c1c36b098aa04d5b33ea10 Mon Sep 17 00:00:00 2001 From: vabc3 Date: Sun, 24 Jul 2022 15:36:44 +0800 Subject: [PATCH] Enforce utf-8 format when write html Support writing html when system default is not utf-8 --- backtrader_plotting/bokeh/bokeh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backtrader_plotting/bokeh/bokeh.py b/backtrader_plotting/bokeh/bokeh.py index f63abb0..3ec1d22 100644 --- a/backtrader_plotting/bokeh/bokeh.py +++ b/backtrader_plotting/bokeh/bokeh.py @@ -414,7 +414,7 @@ def _output_plot_file(self, model, idx, filename=None, template="basic.html.j2") ) ) - with open(filename, 'w') as f: + with open(filename, 'w', encoding='utf-8') as f: f.write(html) return filename