From fe90f4836a37fc7210aa9fd351b8ca786ee9bf23 Mon Sep 17 00:00:00 2001 From: Hess Chen Date: Wed, 8 Jul 2015 05:43:22 +0000 Subject: BaseTools/Upt: Add a BOM check for UNI file and fix some help message error Add a BOM check for UNI file and fix some help message error Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen Reviewed-by: YangX Li git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17876 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/UPT/Library/ParserValidate.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'BaseTools/Source/Python/UPT/Library/ParserValidate.py') diff --git a/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/BaseTools/Source/Python/UPT/Library/ParserValidate.py index bfb4bc749f..e973227898 100644 --- a/BaseTools/Source/Python/UPT/Library/ParserValidate.py +++ b/BaseTools/Source/Python/UPT/Library/ParserValidate.py @@ -721,3 +721,12 @@ def IsValidUserId(UserId): return False return True +# +# Check if a UTF16-LE file has a BOM header +# +def CheckUTF16FileHeader(File): + FileIn = open(File, 'rb').read(2) + if FileIn != '\xff\xfe': + return False + + return True -- cgit v1.2.3