##\r
# Import Modules\r
#\r
+from __future__ import print_function\r
import Common.LongFilePathOs as os, codecs, re\r
import distutils.util\r
import Common.EdkLogger as EdkLogger\r
\r
gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", re.MULTILINE | re.UNICODE)\r
\r
+## Convert a python unicode string to a normal string\r
+#\r
+# Convert a python unicode string to a normal string\r
+# UniToStr(u'I am a string') is 'I am a string'\r
+#\r
+# @param Uni: The python unicode string\r
+#\r
+# @retval: The formatted normal string\r
+#\r
+def UniToStr(Uni):\r
+ return repr(Uni)[2:-1]\r
+\r
## Convert a unicode string to a Hex list\r
#\r
# Convert a unicode string to a Hex list\r
if EndPos != -1 and EndPos - StartPos == 6 :\r
if g4HexChar.match(Line[StartPos + 2 : EndPos], re.UNICODE):\r
EndStr = Line[EndPos: ]\r
- UniStr = Line[StartPos + 2: EndPos]\r
+ UniStr = ('\u' + (Line[StartPos + 2 : EndPos])).decode('unicode_escape')\r
if EndStr.startswith(u'\\x') and len(EndStr) >= 7:\r
if EndStr[6] == u'\\' and g4HexChar.match(EndStr[2 : 6], re.UNICODE):\r
Line = Line[0 : StartPos] + UniStr + EndStr\r