Skip to content

Commit

Permalink
chore: fix byte encode
Browse files Browse the repository at this point in the history
  • Loading branch information
YiniXu9506 committed Sep 9, 2021
1 parent 7db1f25 commit 5d59c8c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions scripts/check-conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
single = []
lineNum = 0
if os.path.isfile(filename):
with open(filename,'r') as file:
with open(filename,'r', encoding='utf-8') as file:
for line in file:
lineNum += 1
if re.match(r'<{7}.*\n', line):
Expand All @@ -57,15 +57,15 @@
flag = 0
else:
continue


if len(pos):
mark = 1
print("\n" + filename + ": this file has conflicts in the following lines:\n")
for conflict in pos:
if len(conflict) == 2:
print("CONFLICTS: line " + str(conflict[0]) + " to line " + str(conflict[1]) + "\n")

pos = []

if mark:
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-control-char.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def check_control_char(filename):
pos = []
flag = 0

with open(filename,'r') as file:
with open(filename,'r', encoding='utf-8') as file:
for line in file:

lineNum += 1
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-file-encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def check_BOM(filename):
BUFSIZE = 4096
BOMLEN = len(codecs.BOM_UTF8)

with open(filename, "r+b") as fp:
with open(filename, "r+b", encoding='utf-8') as fp:
chunk = fp.read(BUFSIZE)
if chunk.startswith(codecs.BOM_UTF8):
i = 0
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-manual-line-breaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def check_manual_break(filename):
lineNum = 0
mark = 0

with open(filename,'r') as file:
with open(filename,'r', encoding='utf-8') as file:
for line in file:

lineNum += 1
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def filter_frontmatter(content):
if len(collect) >= 2:
filter_point = collect[1]
content = content[filter_point:]

return content

def filter_backticks(content, filename):
Expand Down Expand Up @@ -140,7 +140,7 @@ def filter_backticks(content, filename):
for filename in sys.argv[1:]:
# print("Checking " + filename + "......\n")
if os.path.isfile(filename):
file = open(filename, "r" )
file = open(filename, "r", encoding='utf-8')
content = file.read()
file.close()

Expand Down

0 comments on commit 5d59c8c

Please sign in to comment.