我使用JSOM在SharePoint文档库中创建了一个.HTML文件。当我在谷歌浏览器中查看HTML文件时,它会在每个标记的开头显示�符号。 下面是我用来创建HTML文件的代码
var uploadedDocument;
function uploadFile(arrayBuffer, fileName,UploadclientContext,oList)
{
var bytes = new Uint8Array(arrayBuffer);
var i, length, out = '';
for (i = 0, length = bytes.length; i < length; i += 1)
{
out += String.fromCharCode(bytes[i]);
}
var createInfo = new SP.FileCreationInformation();
createInfo.set_url(fileName);
createInfo.set_overwrite(true);
createInfo.set_content(new SP.Base64EncodedByteArray());
fileContent =out;
for (var i = 0; i < fileContent.length; i++)
{
createInfo.get_content().append(fileContent.charCodeAt(i));
}
uploadedDocument = oList.get_rootFolder().get_files().add(createInfo)
UploadclientContext.load(uploadedDocument);
UploadclientContext.executeQueryAsync(QuerySuccess(fileName), QueryFailure);
}
this is HTML is get in browser
谢谢:)