Skip to content

Commit

Permalink
Merge pull request #9 from kbseah/master
Browse files Browse the repository at this point in the history
Fix encoding error (issues #3 and #8)
  • Loading branch information
almiheenko committed May 5, 2020
2 parents a41ac9e + 71c0972 commit d657d3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agb.py
Expand Up @@ -145,7 +145,7 @@ def main():
output_fpath = join(opts.output_dir, HTML_NAME)
with io.open(TEMPLATE_PATH, 'r', encoding="utf-8") as f: html = f.read()
html = embed_css_and_scripts(html)
with open(output_fpath, 'w') as f:
with io.open(output_fpath, 'w', encoding="utf-8") as f:
f.write(html)
print('Assembly graph viewer is saved to ' + output_fpath)

Expand Down
3 changes: 2 additions & 1 deletion agb_src/scripts/utils.py
@@ -1,4 +1,5 @@
import math
import io
import os
import re
import sys
Expand Down Expand Up @@ -218,7 +219,7 @@ def embed_css_and_scripts(html):
line = line_tmpl % rel_fpath
l_tag_formatted = l_tag % rel_fpath

with os.io.open(fpath, 'r', encoding="utf-8") as f: contents = f.read()
with io.open(fpath, 'r', encoding="utf-8") as f: contents = f.read()
contents = '\n'.join(' ' * 8 + l for l in contents.split('\n'))
html = html.replace(line, l_tag_formatted + '\n' + contents + '\n' + r_tag)

Expand Down

0 comments on commit d657d3d

Please sign in to comment.