mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
7d180efeaa
commit
de72c9d1da
|
@ -17,6 +17,7 @@
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
import codecs
|
||||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||||
|
|
||||||
## Create a element of XML
|
## Create a element of XML
|
||||||
|
@ -211,7 +212,7 @@ def XmlNodeName(Dom):
|
||||||
#
|
#
|
||||||
def XmlParseFile(FileName):
|
def XmlParseFile(FileName):
|
||||||
try:
|
try:
|
||||||
XmlFile = open(FileName)
|
XmlFile = codecs.open(FileName,encoding='utf_8_sig')
|
||||||
Dom = xml.dom.minidom.parse(XmlFile)
|
Dom = xml.dom.minidom.parse(XmlFile)
|
||||||
XmlFile.close()
|
XmlFile.close()
|
||||||
return Dom
|
return Dom
|
||||||
|
|
Loading…
Reference in New Issue