UNI spec updated to allow using \x####\ to specify non-ascii characters, # is a hex digit.
Cc: Liming Gao <liming....@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong....@intel.com> --- BaseTools/Source/Python/AutoGen/UniClassObject.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index a01381b..84de53a 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -2,11 +2,11 @@ # This file is used to collect all defined strings in multiple uni files # # # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.<BR> # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php # @@ -421,10 +421,19 @@ class UniFileClassObject(object): Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR) Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR) Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR) + StartPos = Line.find(u'\\x') + while (StartPos != -1): + EndPos = Line.find(u'\\', StartPos + 1, StartPos + 7) + if EndPos != -1 and EndPos - StartPos == 6 : + Str = Line[StartPos : EndPos + 1] + UniStr = ('\u' + (Line[StartPos + 2 : EndPos])).decode('unicode_escape') + Line = Line[0 : StartPos] + (Line[StartPos : EndPos + 1]).replace(Str, UniStr) + Line[EndPos + 1 : ] + StartPos = Line.find(u'\\x', StartPos + 1) + Line = Line.replace(u'\\r\\n', CR + LF) Line = Line.replace(u'\\n', CR + LF) Line = Line.replace(u'\\r', CR) Line = Line.replace(u'\\t', u' ') Line = Line.replace(u'\t', u' ') -- 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel