r366194 - [clang-scan-view] Force utf-8 when handling report (python2 only)
Serge Guelton via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 16 01:56:47 PDT 2019
Author: serge_sans_paille
Date: Tue Jul 16 01:56:47 2019
New Revision: 366194
URL: http://llvm.org/viewvc/llvm-project?rev=366194&view=rev
Log:
[clang-scan-view] Force utf-8 when handling report (python2 only)
Original patch by random human <random.bored.human at gmail.com>
Differential Revision: https://reviews.llvm.org/D64129
Modified:
cfe/trunk/tools/scan-view/share/ScanView.py
Modified: cfe/trunk/tools/scan-view/share/ScanView.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/share/ScanView.py?rev=366194&r1=366193&r2=366194&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/share/ScanView.py (original)
+++ cfe/trunk/tools/scan-view/share/ScanView.py Tue Jul 16 01:56:47 2019
@@ -764,11 +764,11 @@ File Bug</h3>
variables['report'] = m.group(2)
try:
- f = open(path,'r')
+ f = open(path,'rb')
except IOError:
return self.send_404()
fs = os.fstat(f.fileno())
- data = f.read()
+ data = f.read().decode('utf-8')
for a,b in kReportReplacements:
data = a.sub(b % variables, data)
return self.send_string(data, ctype, mtime=fs.st_mtime)
More information about the cfe-commits
mailing list