[clang] b3205e2 - [scan-view] Explicitly use utf-8 in send_string

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 00:31:22 PDT 2020


Author: Tomas Rix
Date: 2020-09-07T09:26:38+02:00
New Revision: b3205e2ace4378600dedba0cc5a42b481c4e22c9

URL: https://github.com/llvm/llvm-project/commit/b3205e2ace4378600dedba0cc5a42b481c4e22c9
DIFF: https://github.com/llvm/llvm-project/commit/b3205e2ace4378600dedba0cc5a42b481c4e22c9.diff

LOG: [scan-view] Explicitly use utf-8 in send_string

send_patched_file decodes with utf-8.
The default encoder for python 2 is ascii.

So it is necessary to also change send_string to use utf-8.

Differential Revision: https://reviews.llvm.org/D83984

Added: 
    

Modified: 
    clang/tools/scan-view/share/ScanView.py

Removed: 
    


################################################################################
diff  --git a/clang/tools/scan-view/share/ScanView.py b/clang/tools/scan-view/share/ScanView.py
index a6cc7692ffe0..5a5d15e85b30 100644
--- a/clang/tools/scan-view/share/ScanView.py
+++ b/clang/tools/scan-view/share/ScanView.py
@@ -744,7 +744,7 @@ def send_file(self, f, ctype):
         return f
 
     def send_string(self, s, ctype='text/html', headers=True, mtime=None):
-        encoded_s = s.encode()
+        encoded_s = s.encode('utf-8')
         if headers:
             self.send_response(200)
             self.send_header("Content-type", ctype)


        


More information about the cfe-commits mailing list