summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BaseTools/Tests/TestTools.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/BaseTools/Tests/TestTools.py b/BaseTools/Tests/TestTools.py
index 4332dcdaac..ace92992fc 100644
--- a/BaseTools/Tests/TestTools.py
+++ b/BaseTools/Tests/TestTools.py
@@ -24,6 +24,7 @@ import shutil
import subprocess
import sys
import unittest
+import codecs
TestsDir = os.path.realpath(os.path.split(sys.argv[0])[0])
BaseToolsDir = os.path.realpath(os.path.join(TestsDir, '..'))
@@ -150,7 +151,7 @@ class BaseToolsTest(unittest.TestCase):
with open(self.GetTmpFilePath(fileName), 'wb') as f:
f.write(data)
else:
- with open(self.GetTmpFilePath(fileName), 'w') as f:
+ with codecs.open(self.GetTmpFilePath(fileName), 'w', encoding='utf-8') as f:
f.write(data)
def GenRandomFileData(self, fileName, minlen = None, maxlen = None):