1
0
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:
plt
2012-07-19 15:51:52 +08:00
parent ea1b664541
commit 7f669b5789

View File

@@ -943,10 +943,10 @@ def repo_file_get(request, repo_id):
else: else:
l, d = [], {} l, d = [], {}
try: try:
u_content = content.decode('utf-8')
except:
# XXX: file in windows is encoded in gbk # XXX: file in windows is encoded in gbk
u_content = content.decode('gbk') u_content = content.decode('gbk')
except:
u_content = content.decode('utf-8')
from django.utils.html import escape from django.utils.html import escape
d['content'] = re.sub("\r\n|\n", "<br />", escape(u_content)) d['content'] = re.sub("\r\n|\n", "<br />", escape(u_content))
l.append(d) l.append(d)