Commit a61352d0 authored by 陈志良's avatar 陈志良

添加UTF-8转码

parent 4b6a8e1b
......@@ -1169,7 +1169,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
nickName = comment.from.nickName || '游客';
}
var this_row = [floor + '', time,openId, nickName, content, praiseCount.toString(), praiseNames,praiseOpenIds,null,null];
var this_row = [floor + '', time,openId, nickName, encode(content,'utf-8'), praiseCount.toString(), praiseNames,praiseOpenIds,null,null];
rows.push(this_row);
if(comment.comments.length > 0){
for (var k = 0; k < comment.comments.length; k++) {
......@@ -1194,6 +1194,7 @@ router.get('/thread/:tid/exportComments', function(req, res, next) {
};
conf.rows = rows;
var result = nodeExcel.execute(conf);
res.charset = 'utf-8';
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
res.setHeader('Content-Disposition', 'attachment; filename=commentsReport.xlsx');
res.end(result, 'binary');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment