11from __future__ import absolute_import
22
3+ import io
34import json
45import logging
56import os
@@ -526,7 +527,7 @@ def process_substitutions(bom_name_format, pcb_file_name, metadata):
526527def generate_file (pcb_file_dir , pcb_file_name , pcbdata , config ):
527528 def get_file_content (file_name ):
528529 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 :
530531 return f .read ()
531532
532533 loginfo ("Dumping pcb json data" )
@@ -545,13 +546,14 @@ def get_file_content(file_name):
545546 html = get_file_content ("ibom.html" )
546547 html = html .replace ('///CSS///' , get_file_content ('ibom.css' ))
547548 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' ))
549551 html = html .replace ('///CONFIG///' , config_js )
550552 html = html .replace ('///PCBDATA///' , pcbdata_js )
551553 html = html .replace ('///UTILJS///' , get_file_content ('util.js' ))
552554 html = html .replace ('///RENDERJS///' , get_file_content ('render.js' ))
553555 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 :
555557 bom .write (html )
556558 loginfo ("Created file %s" , bom_file_name )
557559 return bom_file_name
0 commit comments