Possible to disable writing the BOM whan saving?

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Possible to disable writing the BOM whan saving?

Postby john333 » Mon Apr 14, 2014 1:27 pm

Is there a way to prevent TextEditorPane.save() from writing out the BOM? We are using this in a scenario where the file written is getting included in some other file which causes the BOM to appear in the middle of a file.
Of course I can use my own save method instead, but doing this with the TextEditorPane.save() method is just so much more elegant and convenient.
Thanks, John.
john333
 

Re: Possible to disable writing the BOM whan saving?

Postby robert » Wed Apr 16, 2014 12:18 pm

I don't know why there isn't a more direct method for this, but you just have to call:

java code:

System.setProperty(UnicodeWriter.PROPERTY_WRITE_UTF8_BOM, "false");


UnicodeWriter is used by TextEditorPane under the covers, and it defaults to writing the BOM.

I'll probably modify the API to make this a little more obvious in the next release.
User avatar
robert
 
Posts: 805
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron