From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BA401219392FD for ; Tue, 4 Apr 2017 19:23:28 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 04 Apr 2017 19:23:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,276,1486454400"; d="scan'208";a="69439096" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 04 Apr 2017 19:23:28 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 4 Apr 2017 19:23:28 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 4 Apr 2017 19:23:27 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.217]) with mapi id 14.03.0319.002; Wed, 5 Apr 2017 10:23:26 +0800 From: "Zhu, Yonghong" To: "Chen, Hesheng" , "edk2-devel@lists.01.org" Thread-Topic: [patch 2/3] BaseTools/UPT: Support Unicode path Thread-Index: AQHSqql7/aD8OxSbwU+rLP2UThqkHqG2Ed3g Date: Wed, 5 Apr 2017 02:23:25 +0000 Message-ID: References: <1491024785-9388-1-git-send-email-hesheng.chen@intel.com> <1491024785-9388-2-git-send-email-hesheng.chen@intel.com> In-Reply-To: <1491024785-9388-2-git-send-email-hesheng.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDcyM2U1MWUtYzkwZS00NzBmLThhYTAtYjVlMWMxZWQzM2ZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Ink3OGtmMHF3cEhJVzJMYllyYTBCcmg4NmdZSEd4blUzOUs3U1I2bVBUSnM9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 2/3] BaseTools/UPT: Support Unicode path X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 02:23:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Chen, Hesheng=20 Sent: Saturday, April 1, 2017 1:33 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [patch 2/3] BaseTools/UPT: Support Unicode path Update the IpiDb.py to support Unicode path for localization Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hesschen --- BaseTools/Source/Python/UPT/Core/IpiDb.py | 8 ++++---- BaseTools/Source/Python/UPT/UPT.py | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/UPT/Core/IpiDb.py b/BaseTools/Source/P= ython/UPT/Core/IpiDb.py index 2c444f9..f147963 100644 --- a/BaseTools/Source/Python/UPT/Core/IpiDb.py +++ b/BaseTools/Source/Python/UPT/Core/IpiDb.py @@ -1,7 +1,7 @@ ## @file # This file is for installed package information database operations # -#= Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials are licensed and made availa= ble # under the terms and conditions of the BSD License which accompanies = this @@ -44,7 +44,7 @@ class IpiDatabase(object): Dir =3D os.path.dirname(DbPath) if not os.path.isdir(Dir): os.mkdir(Dir) - self.Conn =3D sqlite3.connect(DbPath, isolation_level=3D'DEFERRED'= ) + self.Conn =3D sqlite3.connect(unicode(DbPath),=20 + isolation_level=3D'DEFERRED') self.Conn.execute("PRAGMA page_size=3D4096") self.Conn.execute("PRAGMA synchronous=3DOFF") self.Cur =3D self.Conn.cursor() @@ -614,8 +614,8 @@ class IpiDatabase(object): # @param DistributionFile: Distribution File =20 # def GetDpByName(self, DistributionFile): - SqlCommand =3D """select * from %s where NewPkgFileName like '%s'"= "" % \ - (self.DpTable, '%' + DistributionFile) + SqlCommand =3D """select * from %s where NewPkgFileName =3D '%s'""= " % \ + (self.DpTable, DistributionFile) self.Cur.execute(SqlCommand) =20 for Result in self.Cur: diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/U= PT/UPT.py index 873492d..d98b469 100644 --- a/BaseTools/Source/Python/UPT/UPT.py +++ b/BaseTools/Source/Python/UPT/UPT.py @@ -19,8 +19,13 @@ UPT =20 ## import modules # -from Core import FileHook +import locale import sys +encoding =3D locale.getdefaultlocale()[1] if encoding: + reload(sys) + sys.setdefaultencoding(encoding) +from Core import FileHook import os.path from sys import platform import platform as pf -- 2.7.2.windows.1