In LibreOffice, if I save a document as file type "encoded text" and select "Unicode (UTF-8)" as the encoding, it always writes a byte order mark (BOM) at the start of the text. It does this even when exporting text that started out with no such mark (such as imported ISO-8859-8 text). Is there a way to suppress the generation of the BOM?

According to the Unicode docs: "Where UTF-8 is used transparently in 8-bit environments, the use of a BOM will interfere with any protocol or file format that expects specific ASCII characters at the beginning". This is exactly the problem I'm running into, as the text is going to be fed to a program that does not expect an initial BOM.

up vote 1 down vote accepted

There is pending 2018 patch attached to a relevant 2011 bug report

Martin van Zijl 2018-02-26 18:48:14 UTC

I created a patch for review. With this patch if you do:

1) File --> Save As...
2) Choose Type = "Text (Choose Encoding)"
3) Click "Use Text - ..."
4) In the final dialog will be a checkbox "Include byte-order-mark". If you un-check this, then the BOM will not be included in the output.

Video demo attached.

Review link: https://gerrit.libreoffice.org/#/c/50388/

  • Good to know that this is finally being addressed. The BOM is useful for UTF-16 encoding, but has no value and should be removed for UTF-8 exports. I noticed this comment in the bug report thread: "I agree with this. But currently we have very few developers. This may take several years. Sorry for such situation." It's going on seven years, so whoever made that comment is apparently a good estimator. :) – Ted Hopp Mar 9 at 20:49

When saving the file with Save As, under All Formats select Text Encoded, then Save. When the Confirm File Format dialog comes up, select Use Text Encoded Format. The ASCII Filter Options dialog then comes up. Select Western Europe(ASCII/US) and click OK. If you then examine the resulting file with a hex editor such as Bless, you will see that the BOM is gone.

  • 4
    Well of course the BOM is gone, but the file is no longer encoded in UTF-8, either! – kreemoweet Mar 10 '14 at 16:25
  • 1
    And then none Western Europe characters as well as Western Europe characters above 127 are gone too – phuclv Dec 18 '14 at 14:44
  • Sorry, but this doesn't address the question at all. I need a way to export UTF-8 text from LibreOffice without a BOM. – Ted Hopp Jul 13 '15 at 21:05
  • @TedHopp well, what if you choose the option he says? Run the "file" command on the file, and see what it says. You could try editing the hex of the UTF-8 file and removing the BOM. Did you try any of that? – barlop Aug 27 '15 at 15:13
  • 1
    @barlop - The option he suggests results in garbage in the file in place of non-ASCII characters (e.g., Cyrillic, Hebrew, Greek, etc.) I fail to see how the "file" command would be useful. Editing the hex and removing the BOM might work for a file here or there, but is totally unsuitable for production work. Plus, it doesn't address my question at all: is there a way to suppress the generation of the BOM from LibreOffice? – Ted Hopp Aug 27 '15 at 17:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.