1

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);  
}  

this is HTML is get in browserenter image description here

1

Try to add below line in your html file

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-8">
  • Thanks for responding, but I would like to add another thing here that this HTML is rendering perfectly fine in IE ,Edge and Firefox so I don't think it has anything to do with the encoding of the HTML – Shreyas Jain Jan 13 '17 at 9:47
  • The meta tag might not be the solution but this is an encoding issue – Danny '365CSI' Engelman Jan 13 '17 at 10:20
  • @Danny'365CSI'Engelman if it is an encoding issue then I think it should show the same error on every browser rather it is rendering perfectly fine on IE,Edge and Firefox.I think it has something to do with the method I used to ready the arraybuffer – Shreyas Jain Jan 13 '17 at 11:43
  • semantics .. you encoded something incorrect.. – Danny '365CSI' Engelman Jan 13 '17 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.