Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix byte encode #6428

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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