From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.8662.1624870010766786476 for ; Mon, 28 Jun 2021 01:46:51 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: yuwei.chen@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10028"; a="204906783" X-IronPort-AV: E=Sophos;i="5.83,305,1616482800"; d="scan'208";a="204906783" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2021 01:46:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,305,1616482800"; d="scan'208";a="407658486" Received: from yuweipc.ccr.corp.intel.com ([10.239.158.34]) by orsmga006.jf.intel.com with ESMTP; 28 Jun 2021 01:46:44 -0700 From: "Yuwei Chen" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [PATCH 1/1] BaseTools: Remove non-ascii character of StructurePcd comment Date: Mon, 28 Jun 2021 16:46:44 +0800 Message-Id: <20210628084644.539-1-yuwei.chen@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Bob Feng Cc: Liming Gao --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py index 2052db8c4b69..2baabf2dd521 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -284,7 +284,15 @@ class Config(object): line=x.split('\n')[0] comment_list = value_re.findall(line) # the string \\... in "Q...." line comment_list[0] = comment_list[0].replace('//', '') - comment = comment_list[0].strip() + comment_ori = comment_list[0].strip() + comment = "" + for each in comment_ori: + if each != " " and "\x21" > each or each > "\x7E": + if bytes(each, 'utf-16') == b'\xff\xfe\xae\x00': + each = '(R)' + else: + each = "" + comment += each line=value_re.sub('',line) #delete \\... in "Q...." line list1=line.split(' ') value=self.value_parser(list1) -- 2.27.0.windows.1