mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 07:01:12 +00:00
Fix utf8 chinese decode bug
This commit is contained in:
4
views.py
4
views.py
@@ -943,10 +943,10 @@ def repo_file_get(request, repo_id):
|
||||
else:
|
||||
l, d = [], {}
|
||||
try:
|
||||
u_content = content.decode('utf-8')
|
||||
except:
|
||||
# XXX: file in windows is encoded in gbk
|
||||
u_content = content.decode('gbk')
|
||||
except:
|
||||
u_content = content.decode('utf-8')
|
||||
from django.utils.html import escape
|
||||
d['content'] = re.sub("\r\n|\n", "<br />", escape(u_content))
|
||||
l.append(d)
|
||||
|
Reference in New Issue
Block a user