Campaign | How to save a file using saveFile() function without BOM
Description description
Issue: When we use the saveFile()
JS function in Adobe Campaign and select the encoding to be UTF-8, it saves the file in UTF-8 with BOM format.
Syntax: saveFile ("Text to be saved", "Server location where the file will be saved/File name","Encoding");
Resolution resolution
By default, when we use the function saveFile()
as:
saveFile ("Text to be saved", "Server location where the file will be saved/File name","utf-8");
The file is saved with the format UTF-8 with BOM
What is BOM:
The byte order mark (BOM) is a Unicode character, U+FEFF BYTE ORDER MARK (BOM), whose appearance as a magic number at the start of a text stream can signal several things to a program reading the text:
- The byte order, or endianness, of the text stream;
- The fact that the text stream’s encoding is Unicode, to a high level of confidence;
- Which Unicode encoding the text stream is encoded as.
To avoid this, the resolution is to skip the encoding part in the function’s syntax. So use it like:
saveFile ("Text to be saved", "Server location where the file will be saved/File name");
This will save the file in UTF-8 format but without BOM
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f