Revision: 17697
          http://sourceforge.net/p/edk2/code/17697
Author:   jljusten
Date:     2015-06-23 23:34:33 +0000 (Tue, 23 Jun 2015)
Log Message:
-----------
BaseTools/Tests: Verify 32-bit UTF-8 chars are rejected

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 <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Reviewed-by: Yingke Liu <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py

Modified: trunk/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py
===================================================================
--- trunk/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py       2015-06-23 
23:34:28 UTC (rev 17696)
+++ trunk/edk2/BaseTools/Tests/CheckUnicodeSourceFiles.py       2015-06-23 
23:34:33 UTC (rev 17697)
@@ -114,6 +114,31 @@
 
         self.CheckFile(encoding=None, 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__':


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to