<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Setting codepage dynamically in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Setting-codepage-dynamically/m-p/511151#M690576</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a bunch of CSV files in one folder and it seems that some of them are encoded in Unicode and some are ANSI. Is there a way to make a script so that it dynamically determines the right "codepage is xxx" in the script? I was thinking that I could just disable errors for that part of the script and load the data by using both codepages but it's something I really don't want to do. Not sure if it even works though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Teemu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2013 06:25:09 GMT</pubDate>
    <dc:creator>teempi</dc:creator>
    <dc:date>2013-10-04T06:25:09Z</dc:date>
    <item>
      <title>Setting codepage dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-codepage-dynamically/m-p/511151#M690576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a bunch of CSV files in one folder and it seems that some of them are encoded in Unicode and some are ANSI. Is there a way to make a script so that it dynamically determines the right "codepage is xxx" in the script? I was thinking that I could just disable errors for that part of the script and load the data by using both codepages but it's something I really don't want to do. Not sure if it even works though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Teemu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 06:25:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-codepage-dynamically/m-p/511151#M690576</guid>
      <dc:creator>teempi</dc:creator>
      <dc:date>2013-10-04T06:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Setting codepage dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-codepage-dynamically/m-p/1546545#M690577</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/14444"&gt;@teempi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see Rob Wunderlich's post in this thread&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/QlikView-Management/Load-Log-File-Encoding/m-p/884711?collapse_discussion=true&amp;amp;q=unicode%20codepage%20log&amp;amp;search_type=thread" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Management/Load-Log-File-Encoding/m-p/884711?collapse_discussion=true&amp;amp;q=unicode%20codepage%20log&amp;amp;search_type=thread&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"What I do is test the first character of the logfile with various encodings&amp;nbsp; 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."&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;FOR EACH vEncoding IN 'utf8', 'unicode', 'codepage is 1252';

  TempCode:

  FIRST 1 // Log first row

  LOAD IsNum(left(@1:n,1)) as X // Test first char. Set to true if it's a number.

  FROM

  [$(_logpath)]

  (fix, $(vEncoding))

  ;

  EXIT FOR WHEN peek('X'); // If a number, assume we have the right encoding.

NEXT vEncoding;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Feb 2019 19:02:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-codepage-dynamically/m-p/1546545#M690577</guid>
      <dc:creator>p_verkooijen</dc:creator>
      <dc:date>2019-02-19T19:02:36Z</dc:date>
    </item>
  </channel>
</rss>

