Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert a CSV UTF-8 to UTF-8-BOM

Hello,

 

Please i need some help.
I have to output a CSV file in UTF-8-BOM for my client, because in UTF-8 several special caracters are not encoding as well...

 

In this topic, I found a routine which can encode CSV file, but not in UTF-8-BOM...

https://community.talend.com/t5/Design-and-Development/tChangeFileEncoding-and-UTF8-encoding/m-p/149...

 

Please, somebody has a solution to this problem ?

PS: not by passing with the custom component  tWriteHeaderLineToFileWithBOM

Labels (3)
11 Replies
Anonymous
Not applicable
Author

I don't know why title of my CSV column disapear...

So i changed your tJava code for this code and it's work :

 

 

String filename = "test.csv";
String content="";
byte[] bytes = content.getBytes();
 

try (PrintStream w = new PrintStream(new FileOutputStream(filename))) {
	w.write('\ufeef'); // emits 0xef
    w.write('\ufebb'); // emits 0xbb
    w.write('\ufebf'); // emits 0xbf
    w.print("OptionValue,OptionName\n");
} catch (IOException e) {
	e.printStackTrace();
}


Thanks you again @rhall 

Anonymous
Not applicable
Author

Oh I see. You raised a question about file name and row count previously didn't you? All you need to do to enable that is to put the tJava before the subjob that writes the header values. But you seem to have sorted this 🙂