中文字符从javascript传递到Excel时会损坏

function View_ParamReport() { var xmlPathName = inputPath.innerText; //Based on the input selcted it selectes the particular xslt code and generates the xml output var xml = new ActiveXObject("Msxml2.DOMDocument.6.0"); xml.async=false; xml.load(xmlPathName); var xsl = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0"); xsl.setProperty("AllowDocumentFunction", true); xsl.async=false; var xslTemp = new ActiveXObject("Msxml2.XSLTemplate.6.0"); xslTemp.stylesheet = xsl; var xslProc = xslTemp.createProcessor(); xslProc.input = xml; try { xslProc.transform; var report2= xslProc.output; var fso = new ActiveXObject("Scripting.FileSystemObject"); var filePath = "C:\\Program Files (x86)\\" + orderNumber + ".xls"; var s = fso.CreateTextFile(filePath, true); s.WriteLine(report2); //If I pass some chinese character in the report2 it is //getting corrupted. //Eg:s.WriteLine("订单编号"); gives ???? in the excel s.Close(); window.open(filePath); } catch(e) { } } 

我正在尝试使用JavaScript将xsl输出传递给Excel。 当输出是英文时它工作正常。 但是当它是英文和中文的混合时,它正确地显示英文字母,但中文字符变成损坏的string。 我正在使用Excel 2013.我该如何解决这个问题?