Since UTF-8 .uni unicode files might contain strings with unicode code points larger than 16-bits, and UEFI only supports UCS-2 characters, we need to make sure that BaseTools rejects these characters in UTF-8 .uni source files.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> Cc: Yingke D Liu <yingke.d....@intel.com> --- BaseTools/Tests/CheckUnicodeSourceFiles.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/BaseTools/Tests/CheckUnicodeSourceFiles.py b/BaseTools/Tests/CheckUnicodeSourceFiles.py index 39fd2fe..1b17377 100644 --- a/BaseTools/Tests/CheckUnicodeSourceFiles.py +++ b/BaseTools/Tests/CheckUnicodeSourceFiles.py @@ -96,6 +96,31 @@ class Tests(TestTools.BaseToolsTest): self.CheckFile('utf_16', shouldPass=False, string=data) + def test32bitUnicodeCharInUtf8File(self): + data = u''' + #langdef en-US "English" + #string STR_A #language en-US "CodePoint (\U00010300) > 0xFFFF" + ''' + + self.CheckFile('utf_16', shouldPass=False, string=data) + + def test32bitUnicodeCharInUtf8File(self): + data = u''' + #langdef en-US "English" + #string STR_A #language en-US "CodePoint (\U00010300) > 0xFFFF" + ''' + + self.CheckFile('utf_8', shouldPass=False, string=data) + + def test32bitUnicodeCharInUtf8Comment(self): + data = u''' + // Even in comments, we reject non-UCS-2 chars: \U00010300 + #langdef en-US "English" + #string STR_A #language en-US "A" + ''' + + self.CheckFile('utf_8', shouldPass=False, string=data) + TheTestSuite = TestTools.MakeTheTestSuite(locals()) if __name__ == '__main__': -- 2.1.4 ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel