Skip to content
Snippets Groups Projects
Commit 058426e4 authored by Fadi Imani's avatar Fadi Imani
Browse files

big project

parent f714756a
No related branches found
No related tags found
No related merge requests found
Pipeline #40556 failed
...@@ -43,7 +43,7 @@ class ExitStatus: ...@@ -43,7 +43,7 @@ class ExitStatus:
def excludes_from_file(ignore_file): def excludes_from_file(ignore_file):
excludes = [] excludes = []
try: try:
with io.open(ignore_file, 'r', encoding='utf-8') as f: with io.open(ignore_file, 'r', encoding='ISO-8859-1') as f:
for line in f: for line in f:
if line.startswith('#'): if line.startswith('#'):
# ignore comments # ignore comments
...@@ -126,24 +126,24 @@ def run_clang_format_diff_wrapper(args, file): ...@@ -126,24 +126,24 @@ def run_clang_format_diff_wrapper(args, file):
def run_clang_format_diff(args, file): def run_clang_format_diff(args, file):
try: try:
with io.open(file, 'r', encoding='utf-8') as f: with io.open(file, 'r', encoding='ISO-8859-1') as f:
original = f.readlines() original = f.readlines()
except IOError as exc: except IOError as exc:
raise DiffError(str(exc)) raise DiffError(str(exc))
invocation = [args.clang_format_executable, file] invocation = [args.clang_format_executable, file]
# Use of utf-8 to decode the process output. # Use of ISO-8859-1 to decode the process output.
# #
# Hopefully, this is the correct thing to do. # Hopefully, this is the correct thing to do.
# #
# It's done due to the following assumptions (which may be incorrect): # It's done due to the following assumptions (which may be incorrect):
# - clang-format will returns the bytes read from the files as-is, # - clang-format will returns the bytes read from the files as-is,
# without conversion, and it is already assumed that the files use utf-8. # without conversion, and it is already assumed that the files use ISO-8859-1.
# - if the diagnostics were internationalized, they would use utf-8: # - if the diagnostics were internationalized, they would use ISO-8859-1:
# > Adding Translations to Clang # > Adding Translations to Clang
# > # >
# > Not possible yet! # > Not possible yet!
# > Diagnostic strings should be written in UTF-8, # > Diagnostic strings should be written in ISO-8859-1,
# > the client can translate to the relevant code page if needed. # > the client can translate to the relevant code page if needed.
# > Each translation completely replaces the format string # > Each translation completely replaces the format string
# > for the diagnostic. # > for the diagnostic.
...@@ -152,7 +152,7 @@ def run_clang_format_diff(args, file): ...@@ -152,7 +152,7 @@ def run_clang_format_diff(args, file):
# It's not pretty, due to Python 2 & 3 compatibility. # It's not pretty, due to Python 2 & 3 compatibility.
encoding_py3 = {} encoding_py3 = {}
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
encoding_py3['encoding'] = 'utf-8' encoding_py3['encoding'] = 'ISO-8859-1'
try: try:
proc = subprocess.Popen( proc = subprocess.Popen(
...@@ -172,7 +172,7 @@ def run_clang_format_diff(args, file): ...@@ -172,7 +172,7 @@ def run_clang_format_diff(args, file):
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
# make the pipes compatible with Python 3, # make the pipes compatible with Python 3,
# reading lines should output unicode # reading lines should output unicode
encoding = 'utf-8' encoding = 'ISO-8859-1'
proc_stdout = codecs.getreader(encoding)(proc_stdout) proc_stdout = codecs.getreader(encoding)(proc_stdout)
proc_stderr = codecs.getreader(encoding)(proc_stderr) proc_stderr = codecs.getreader(encoding)(proc_stderr)
# hopefully the stderr pipe won't get full and block the process # hopefully the stderr pipe won't get full and block the process
...@@ -223,7 +223,7 @@ def print_diff(diff_lines, use_color): ...@@ -223,7 +223,7 @@ def print_diff(diff_lines, use_color):
if use_color: if use_color:
diff_lines = colorize(diff_lines) diff_lines = colorize(diff_lines)
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
sys.stdout.writelines((l.encode('utf-8') for l in diff_lines)) sys.stdout.writelines((l.encode('ISO-8859-1') for l in diff_lines))
else: else:
sys.stdout.writelines(diff_lines) sys.stdout.writelines(diff_lines)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment