ソースを参照

fix tipue_search crash if system encoding is cp949

Use encode='utf-8' instead of 'rb' when file read for beautifulSoup4
thanks to @avaris
if1live 9 年 前
コミット
5bd6a72c76
共有1 個のファイルを変更した1 個の追加1 個の削除を含む
  1. 1 1
      tipue_search/tipue_search.py

+ 1 - 1
tipue_search/tipue_search.py

@@ -64,7 +64,7 @@ class Tipue_Search_JSON_Generator(object):
 
     def create_tpage_node(self, srclink):
 
-        srcfile = open(os.path.join(self.output_path, self.tpages[srclink]))
+        srcfile = open(os.path.join(self.output_path, self.tpages[srclink]), encoding='utf-8')
         soup = BeautifulSoup(srcfile, 'html.parser')
         page_text = soup.get_text()