Browse Source

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 years ago
parent
commit
5bd6a72c76
1 changed files with 1 additions and 1 deletions
  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()