diff options
author | Fan, ZhijuX <zhijux.fan@intel.com> | 2019-02-26 14:57:44 +0800 |
---|---|---|
committer | Feng, Bob C <bob.c.feng@intel.com> | 2019-02-27 09:39:09 +0800 |
commit | de72c9d1da8d2d81477f921644db7a55912cddf6 (patch) | |
tree | ffe716f8bf0de4cb585dd4318307e686090ad6a5 /BaseTools | |
parent | 7d180efeaa03df25973416dc0aad099f4fe7e251 (diff) | |
download | edk2-de72c9d1da8d2d81477f921644db7a55912cddf6.tar.gz edk2-de72c9d1da8d2d81477f921644db7a55912cddf6.tar.bz2 edk2-de72c9d1da8d2d81477f921644db7a55912cddf6.zip |
BaseTools:The BOM character is processed when python reads a file
When python3 reads an XML file it will parse the file in error
if the file has a BOM
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>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py index 4294016ae3..00cbc4e55e 100644 --- a/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py +++ b/BaseTools/Source/Python/Ecc/Xml/XmlRoutines.py @@ -17,6 +17,7 @@ #
from __future__ import print_function
import xml.dom.minidom
+import codecs
from Common.LongFilePathSupport import OpenLongFilePath as open
## Create a element of XML
@@ -211,7 +212,7 @@ def XmlNodeName(Dom): #
def XmlParseFile(FileName):
try:
- XmlFile = open(FileName)
+ XmlFile = codecs.open(FileName,encoding='utf_8_sig')
Dom = xml.dom.minidom.parse(XmlFile)
XmlFile.close()
return Dom
|