Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

How store txt in ANSI ?

Good Mornig,

I need to make a SQLServer bulk insert, but SQLServer does not support UTF8(1252) for Bulk insert, and the Qlikview dont Store a txt file in other codepage, just UTF8.

How can i export/store a txt file in codepage ANSI or 65001 ?

1 Solution

Accepted Solutions
Highlighted
Employee
Employee

Re: How store txt in ANSI ?

QlikView does not support exporting other than utf

View solution in original post

9 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: How store txt in ANSI ?

You'll have to convert the text file using an editor (like notepad++) or other utility that supports such conversions. Or write a macro that can do such a conversion. As you noticed Qlikview doesn't support other codepages for the STORE command.


talk is cheap, supply exceeds demand
Highlighted
Employee
Employee

Re: How store txt in ANSI ?

QlikView does not support exporting other than utf

View solution in original post

Highlighted
Employee
Employee

Re: Re: How store txt in ANSI ?

This vbs script should do what you need

Option Explicit

Private Const adReadAll = -1
Private Const adSaveCreateOverWrite = 2
Private Const adTypeBinary = 1
Private Const adTypeText = 2
Private Const adWriteChar = 0

Private Sub UTF8toANSI(ByVal UTF8FName, ByVal ANSIFName)
  Dim strText

  With CreateObject("ADODB.Stream")
  .Open
  .Type = adTypeBinary
  .LoadFromFile UTF8FName
  .Type = adTypeText
  .Charset = "utf-8"
  strText = .ReadText(adReadAll)
  .Position = 0
  .SetEOS
  .Charset = "iso-8859-1"
  .WriteText strText, adWriteChar
  .SaveToFile ANSIFName, adSaveCreateOverWrite
  .Close
  End With
End Sub

UTF8toANSI WScript.Arguments(0), WScript.Arguments(1)
Highlighted
Creator
Creator

Re: How store txt in ANSI ?

Thanks for Reply.

It works well like notepad, but i am looking for a solution with out human intervention, because the qvw will be in a client server.  😕

Highlighted
Creator
Creator

Re: How store txt in ANSI ?

STORE $(vTabelaAtual)_$(I) INTO $(PathRedeQlikView)\$(vTabelaAtual)_$(I).tmp (txt, delimiter is '#');

EXECUTE cmd.exe /C .\ConvertUTF8toANSI.exe "$(PathRedeQlikView)\$(vTabelaAtual)_$(I).tmp" "$(PathRedeQlikView)\$(vTabelaAtual)_$(I).txt";
Not applicable

Re: How store txt in ANSI ?

Hi Marcus,

Where do you get the ConvertUTF8toANSI.exe tool?

Thanks!

Highlighted
Not applicable

Re: How store txt in ANSI ?

Scratch that.  I got Bomremover.exe to work.

http://community.qlik.com/thread/108070

Highlighted
Creator
Creator

Re: How store txt in ANSI ?

It's a C# "home maked" program.

Highlighted
Contributor II
Contributor II

Re: How store txt in ANSI ?

if you use the bulk insert like this, it works with utf-8

Note: MSDN documentation says utf-8 is not supported, don't believe it, for me this works perfect in SQL server 2005ff

BULK INSERT YourTable

   FROM 'YourCSV.csv'

   WITH (

CODEPAGE = '65001', --> UTF-8

    FIELDTERMINATOR=';'

);