1
1
from __future__ import absolute_import
2
2
3
+ import io
3
4
import json
4
5
import logging
5
6
import os
@@ -526,7 +527,7 @@ def process_substitutions(bom_name_format, pcb_file_name, metadata):
526
527
def generate_file (pcb_file_dir , pcb_file_name , pcbdata , config ):
527
528
def get_file_content (file_name ):
528
529
path = os .path .join (os .path .dirname (__file__ ), ".." , "web" , file_name )
529
- with open (path , "r" ) as f :
530
+ with io . open (path , 'r' , encoding = 'utf-8' ) as f :
530
531
return f .read ()
531
532
532
533
loginfo ("Dumping pcb json data" )
@@ -545,13 +546,14 @@ def get_file_content(file_name):
545
546
html = get_file_content ("ibom.html" )
546
547
html = html .replace ('///CSS///' , get_file_content ('ibom.css' ))
547
548
html = html .replace ('///SPLITJS///' , get_file_content ('split.js' ))
548
- html = html .replace ('///POINTER_EVENTS_POLYFILL///' , get_file_content ('pep.js' ))
549
+ html = html .replace ('///POINTER_EVENTS_POLYFILL///' ,
550
+ get_file_content ('pep.js' ))
549
551
html = html .replace ('///CONFIG///' , config_js )
550
552
html = html .replace ('///PCBDATA///' , pcbdata_js )
551
553
html = html .replace ('///UTILJS///' , get_file_content ('util.js' ))
552
554
html = html .replace ('///RENDERJS///' , get_file_content ('render.js' ))
553
555
html = html .replace ('///IBOMJS///' , get_file_content ('ibom.js' ))
554
- with open (bom_file_name , "wt" ) as bom :
556
+ with io . open (bom_file_name , 'wt' , encoding = 'utf-8' ) as bom :
555
557
bom .write (html )
556
558
loginfo ("Created file %s" , bom_file_name )
557
559
return bom_file_name
0 commit comments