]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Remove non-ascii character of StructurePcd comment
authorChen, Christine <Yuwei.Chen@intel.com>
Mon, 28 Jun 2021 08:46:44 +0000 (16:46 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 12 Jul 2021 02:18:45 +0000 (02:18 +0000)
Currently, the ConvertFceToStructurePcd.py tool generate
StructurePcd dsc file with comments from UNI file including
non-ascii character. Following DSC spec, there should not have
non-ascii character in DSC file. This patch removes the non-ascii
character when adding the comment and changes the circle R to (R).

Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Scripts/ConvertFceToStructurePcd.py

index 2052db8c4b69a51c514e7addb1c15853e47230d1..2baabf2dd5212d23e13ed49b9fbfab89559664f9 100644 (file)
@@ -284,7 +284,15 @@ class Config(object):
         line=x.split('\n')[0]\r
         comment_list = value_re.findall(line) # the string \\... in "Q...." line\r
         comment_list[0] = comment_list[0].replace('//', '')\r
-        comment = comment_list[0].strip()\r
+        comment_ori = comment_list[0].strip()\r
+        comment = ""\r
+        for each in comment_ori:\r
+            if each != " " and "\x21" > each or each > "\x7E":\r
+                if bytes(each, 'utf-16') == b'\xff\xfe\xae\x00':\r
+                    each = '(R)'\r
+                else:\r
+                    each = ""\r
+            comment += each\r
         line=value_re.sub('',line) #delete \\... in "Q...." line\r
         list1=line.split(' ')\r
         value=self.value_parser(list1)\r