diff --git a/tools/matchcompiler.py b/tools/matchcompiler.py index 2104d8903..08c4699d9 100755 --- a/tools/matchcompiler.py +++ b/tools/matchcompiler.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import io import os import sys import re @@ -158,7 +159,7 @@ class MatchCompiler: ret += ' if (!tok || tok->str().size()!=1U || !strchr("' + tok[1:-1] + '", tok->str()[0]))\n' ret += ' ' + returnStatement - # a|b|c + # a|b|c elif tok.find('|') > 0: tokens2 = tok.split('|') logicalOp = None @@ -604,7 +605,7 @@ class MatchCompiler: def convertFile(self, srcname, destname, line_directive): self._reset() - fin = open(srcname, "rt") + fin = io.open(srcname, "rt", encoding="us-ascii") srclines = fin.readlines() fin.close() @@ -637,7 +638,7 @@ class MatchCompiler: if line_directive: lineno = '#line 1 "' + srcname + '"\n' - fout = open(destname, 'wt') + fout = io.open(destname, 'wt', encoding="us-ascii") fout.write(header + strFunctions + lineno + code) fout.close()