]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Capsule/GenerateCapsule.py
BaseTools:Coding problems caused by special characters
[mirror_edk2.git] / BaseTools / Source / Python / Capsule / GenerateCapsule.py
index 7b08918857d8c7a2c5f8952e4a5d3b66c3562413..5ce5daef685cd96a3c185e14215b76e173fd7778 100644 (file)
@@ -94,7 +94,7 @@ def SignPayloadSignTool (Payload, ToolPath, PfxFile):
 \r
     if Process.returncode != 0:\r
         shutil.rmtree (TempDirectoryName)\r
-        print (Result[1].decode())\r
+        print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
         raise ValueError ('GenerateCapsule: error: signtool failed.')\r
 \r
     #\r
@@ -132,12 +132,12 @@ def SignPayloadOpenSsl (Payload, ToolPath, SignerPrivateCertFile, OtherPublicCer
     try:\r
         Process = subprocess.Popen (Command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)\r
         Result = Process.communicate(input = Payload)\r
-        Signature = Result[0]\r
+        Signature = Result[0].decode(encoding='utf-8', errors='ignore')\r
     except:\r
         raise ValueError ('GenerateCapsule: error: can not run openssl.')\r
 \r
     if Process.returncode != 0:\r
-        print (Result[1].decode())\r
+        print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
         raise ValueError ('GenerateCapsule: error: openssl failed.')\r
 \r
     return Signature\r
@@ -186,7 +186,7 @@ def VerifyPayloadOpenSsl (Payload, CertData, ToolPath, SignerPrivateCertFile, Ot
 \r
     if Process.returncode != 0:\r
         shutil.rmtree (TempDirectoryName)\r
-        print (Result[1].decode())\r
+        print (Result[1].decode(encoding='utf-8', errors='ignore'))\r
         raise ValueError ('GenerateCapsule: error: openssl failed.')\r
 \r
     shutil.rmtree (TempDirectoryName)\r