[PATCH] D83984: Explicitly use utf-8 in send_string

Tom Rix via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 13:42:56 PDT 2020


trixirt created this revision.
trixirt added reviewers: serge-sans-paille, michaelplatings.
trixirt added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83984

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


Index: clang/tools/scan-view/share/ScanView.py
===================================================================
--- clang/tools/scan-view/share/ScanView.py
+++ clang/tools/scan-view/share/ScanView.py
@@ -744,7 +744,7 @@
         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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83984.278595.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200716/d7723651/attachment-0001.bin>


More information about the cfe-commits mailing list