I deal with the same problem in my Script Log Analyzer tool. You can download the tool and see how I handle it in the script (see tab "Initial Logdata Load"):
Qlikview Cookbook: Script Log Analyzer http://qlikviewcookbook.com/recipes/download-info/script-log-analyzer/
What I do is test the first character of the logfile with various encodings to see if I can interpret it as a number. When I get a positive I use that encoding to read the file. Probably would break if someone used a MMM-DD-YYYY format, but haven't had a complaint (yet). Here's the relevant code that determines the encoding.
FOR EACH vEncoding IN 'utf8', 'unicode', 'codepage is 1252';
FIRST 1 // Log first row
LOAD IsNum(left(@1:n,1)) as X // Test first char. Set to true if it's a number.
EXIT FOR WHEN peek('X'); // If a number, assume we have the right encoding.
So does that mean it's not possible to select the log file format when reloading through the API like it is with the OCX? I see that the OCX does have "User Preferences" where I presume the option could be changed there. But in the API, I'm creating a document task and then triggering it via EDX-- there is no equivalent to any of the User Preferences in that context?
It did occur to me the file could be examined to figure out what format it's in-- though our post processor is in VB .NET not QlikView script, I'm sure we can figure that out if we have to do it that way. The thing is, we also have field support people that look at these files for diagnosing problems, and having them in different formats out in the field can be confusing at times. Our API reloader is actually in C# and is my responsibility, so I guess one option could be to read the log files after the loads and re-write them in ANSI to make them backwards compatible with the rest of our code...
And I guess another possible solution might be to have the OCX code flip it to Unicode so that at least they're all in the same format.
But our first preference would really be to flip it to ANSI in C# via the QMS API if that were at all possible...
I don't know if there is an available preference option to set the encoding when reloading on the server. Perhaps someone else on the forum knows or you might try QT Support with the question. My situation and solution is different because I need to handle logs from all sorts of environments outside my control. Good luck.
Ok, thanks. In our case, we have dozens of our own internal logs and the QlikView logs get included in them because they're all generated on the same schedule and we scan them for information on the entire app. It's particularly inconvenient to have them in mixed formats because so far they've always been 8-bit. In the short run I've added logic to convert the log to 8-bits when they're copied into our central log repository which takes care of it for now. But I will look further into whether or not that's necessary or if the server can be configured to generate ANSI logs.