diff options
author | Zhiju Fan <zhijux.fan@intel.com> | 2019-01-09 10:31:32 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-02-01 11:09:20 +0800 |
commit | 31e3eeb5e3d2d0b06416ad90d699de51d8761eda (patch) | |
tree | af59bd7df4036680cf629f3ada3062c1fe37f988 /BaseTools | |
parent | 3f7cb70c5a38609cbef2957fccbdf5d6f6a5555b (diff) | |
download | edk2-31e3eeb5e3d2d0b06416ad90d699de51d8761eda.tar.gz edk2-31e3eeb5e3d2d0b06416ad90d699de51d8761eda.tar.bz2 edk2-31e3eeb5e3d2d0b06416ad90d699de51d8761eda.zip |
BaseTools:TestTools character encoding issue
Specifies encoding when opening a file using codecs
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Tests/TestTools.py | 3 |
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):
|