This example does not solve my problem. I am using the STORE command to write a csv file. The example talks about scripts and " File -> Save with encoding -> UTF-8 with BOM" I don't even know what BOM is nor where to find this Save command.
You are changing the encoding, so I would fully expect a difference in things, you are writing it out as UTF-8, but using a different encoding to open, that is going to be a problem, you need to use the same encoding it was saved as...
Here is the Help link, which states we use UTF-8, so you would need to adjust the encoding in an interim step somehow if you need it to be Windows Default, PowerShell might be an option to do that, but no idea how to do so, would likely have to check Microsoft forums on that one.
To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question. I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
I've come across same problem. We are exporting a set of .csv files from Qlikview which are then sent to a third party to load into their application. They have come back complaining of an invalid header caused by those three characters you mentioned. This thread has helped me understand better including the link to UTF-8 BOM.
Not sure if you have resolved. As I understand it Qlikview exports the csv's as UTF-8 BOM format. The BOM is the 3 characters which is tells the reading program that it is in fact UTF-8 format. Apparently that is unnecessary but part of the standard so should be recognised. The application I am sending csv files to must not recognise it, and yours doesn't either. Some info on the topic.
I needed to remove the BOM and also needed to be able to Rename with a Date.
Background, I am exporting a large Fixed Width single column Record.
So, moving data out of Qlik into a text file and then the receiver is putting it into a Unix based No BOM allowed system.
Make sure the 1st row Value is something you don't need. For me it is the field name itself.
That is the row that will contain the BOM.
I've let a variable equal a date. various ways to do that. I made a qualify table with one date in it.
let vDate = FieldValue('dte.dte',1);
let fle = 'V:\MemDirect\mem\pos\bsls\memPOS.txt';
let flenew = 'V:\MemDirect\mem\pos\bsls\bsls_MEM_' & vDate & '.txt';
Store sdg into V:\MemDirect\mem\pos\bsls\memPOS.txt (txt); // stores my single column fixed width record into a text file...unfortunately, it is UTF-8 and has BOM in the first record...so we have to fix that.
EXECUTE cmd.exe /c findstr /V "YourFirstRowFiledName" "$(fle)" > "$(flenew)"; // this finds the BOM Fields (1st row) and ignores it on new file EXECUTE cmd.exe /c del "V:\MemDirect\mem\pos\bsls\memPOS.txt"; // this deletes the original file w BOM leave me just 1 new BOM less File
it is all done in the Qlik Script using DOS commands rather than have to use other programs or reference any .bat files even.
Note: In something related to my project and something for you to think about if providing a similar solution.
I also had to remove all the single quotes, double quotes and commas from my file so they didn't throw off the fixed width the other company uses...this was unfortunate, but it is what it is. replace(replace(replace(replace(YourFirstRowFiledName,'|',''),'''',''),'"',''),',','')