Reputation: 9288
I use the native2ascii.exe included in the java sdk to convert ANSI text to UTF8.
native2ascii.exe -encoding UTF8
The "problem" is: i need to avoid the auto-insert of the "\ufeff" BOM header.
Is there a simple way of avoiding that? Maybe automatically remove ti afterwards?
Thanks.
Upvotes: 1
Views: 911
Reputation: 15683
As Victor pointed out, this is a no-fix 'feature'. What I do is to read the first line of text, and if the first character is the BOM then drop it.
if (firstLine.charAt(0) == '\uFEFF') { firstLine = firstLine.substring(1); }
Upvotes: 1
Reputation: 26597
This is a won't-fix bug: https://bugs.java.com/bugdatabase/view_bug?bug_id=4508058
Upvotes: 1