I created a .HTML file in SharePoint Document library using JSOM. when I view the HTML file in google chrome it shows � symbol at start of each tag. below are the codes that I used to create HTML file
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);
}