Text in Document object of salesforce are being saved in UTF-8 now, but I need to save it in ISO-8859-1/ANSI format.
When I do the following, and try to download the document and look at it's encoding in Notepad++, it is in UTF-8:
Document doc = new Document(); String str = 'Kå Ægir'; Blob bl = Blob.valueOf(str); doc.FolderId = 'dummyFolderID'; doc.Name = 'dummyName'; doc.Body = bl; doc.ContentType = 'text/plain; charset=ISO-8859-1'; doc.Type = 'txt'; insert doc;
But I need it in ISO-8859-1/ANSI. I tried to give 'text/plain; charset=ISO-8859-1' in 'ContentType' field but did not work.
For example, we have option to set 'Encoding' for Email Templates and Reports to 'General US & Western Europe (ISO-8859-1, ISO-LATIN-1)'
Is there a way to do the same with Documents? Or any other similar object?
All I need is, a text file generation in Salesforce(preferably with Apex code) with text like 'Kå Ægir' to be in ANSI/ISO-8859-1/ASCII and NOT in UTF-8 when I download.
Thanks in advance!