Ensure files are read with UTF-8 Encoding

This commit is contained in:
louisnw
2023-07-03 14:14:10 +01:00
parent 4d1ce9e0d7
commit 7850821c6a
5 changed files with 49 additions and 89 deletions

View File

@ -12,7 +12,7 @@ from lightweight_charts.util import LINE_STYLE, MARKER_POSITION, MARKER_SHAPE, C
JS = {}
current_dir = os.path.dirname(os.path.abspath(__file__))
for file in ('pkg', 'funcs', 'callback'):
with open(os.path.join(current_dir, 'js', f'{file}.js'), 'r') as f:
with open(os.path.join(current_dir, 'js', f'{file}.js'), 'r', encoding='utf-8') as f:
JS[file] = f.read()
HTML = f"""
@ -674,6 +674,8 @@ class LWC(SeriesCommon):
{f"{self.id}.legend.style.fontSize = {font_size}" if font_size else ''}
{f"{self.id}.legend.style.fontFamily = '{font_family}'" if font_family else ''}
legendItemFormat = (num) => num.toFixed(2).toString().padStart(8, ' ')
{self.id}.chart.subscribeCrosshairMove((param) => {{
if (param.time){{
let data = param.seriesData.get({self.id}.series);