Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Storing txt file to "UTF-8 without BOM"

Hello community,

I store one field from a resident table loaded from a qvd to a txt file (I've also tried csv).

This txt file is saved with the UTF-8 BOM encoding.

The problem I have with this is that the file contains paths to images that I automatically convert with IrfanView (through the command line). But IfranView throws an error: "Can't read file header" because of the first BOM bytes.

Do you know of a way to automatically remove the BOM or can I change the store option? I've tried a bom remover tool but it had no "silent option" which is not an option.

Thank you,

Thorsten

1 Solution

Accepted Solutions
Not applicable

Re: Storing txt file to "UTF-8 without BOM"

7 Replies
jerrysvensson
Valued Contributor II

Re: Storing txt file to "UTF-8 without BOM"

Could this help?

You can do this in a separate vbs script after your reload.

How store txt in ANSI ?

Not applicable

Re: Storing txt file to "UTF-8 without BOM"

Jerry,

do I put this script in a module or in the script and how would I call it then? Load, Execute, Call?

jerrysvensson
Valued Contributor II

Re: Storing txt file to "UTF-8 without BOM"

Place the code in a vbsfile: For instance utftoansii.vbs

If you have Publisher I would set up an external program task that runs after your reload is finished.

Syntax : cscript.exe utftoansii.vbs

You could place it in QV also, open the macro dialog Ctrl-M and add the code.

Trigger the code in OnPostReload. You have start your reload with a batchjob though.

qv.exe /r app.qvw since Publisher doesn't run triggers.

Not applicable

Re: Storing txt file to "UTF-8 without BOM"

I need to process the txt file before the reload has finished. I'll try to find some tool that I can execute automatically.

Thanks.

Not applicable

Re: Storing txt file to "UTF-8 without BOM"

Not applicable

Re: Storing txt file to "UTF-8 without BOM"

Hi Thorsten,

Stupid question: I need an automated process that calls bomremover.exe from the QlikView script, but it requires the user to click Enter before it runs.

Is this how you run it?  I'm trying to find/remember how to send an <Enter> command, and coming up empty.

Not applicable

Re: Storing txt file to "UTF-8 without BOM"

Nevermind.  Found it.

This works for me:

EXECUTE cmd.exe /c "echo. | c:\Temp\bomremover c:\Temp *.csv";

Community Browser