Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mvaugusto
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
Clever_Anjos
Employee
Employee

QlikView does not support exporting other than utf

View solution in original post

9 Replies
Gysbert_Wassenaar

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
Clever_Anjos
Employee
Employee

QlikView does not support exporting other than utf

Clever_Anjos
Employee
Employee

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)
mvaugusto
Creator
Creator
Author

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.  😕

mvaugusto
Creator
Creator
Author

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

Hi Marcus,

Where do you get the ConvertUTF8toANSI.exe tool?

Thanks!

Not applicable

Scratch that.  I got Bomremover.exe to work.

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

mvaugusto
Creator
Creator
Author

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

rebmanna
Contributor II
Contributor II

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=';'

);