How to remove UTF-8 BOMs at build time

This forum is for all Flare issues not related to any of the other categories.
Post Reply
DeanCloutier
Jr. Propeller Head
Posts: 7
Joined: Tue Sep 23, 2008 4:52 am

How to remove UTF-8 BOMs at build time

Post by DeanCloutier »

Hi
Does anyone know if or how I can remove or omit the inclusion of the byte order mark (BOM) of UTF-8 encoded files when Flare is building a project.

Our system is in PHP on a Linux box, and PHP and Linux do not support the use of BOMs. Calling CSH files in our PHP system produces Junk in Firefox. It seems to be OK in IE. I can manually remove the BOM from most files using an editor like MS Expression or Dreamweaver; however .js and .css files won't retain the changes. Even if those files did retain the change, manually removing the BOM from 100's of files after I've built a project isn't a reasonable solution.

Flare doesn't add the BOM until build time, so is there a setting that I can set to stop Flare from adding the BOMs?

Alternatively, can I reset the encoding?
Thanks
Dean
DeanCloutier
Jr. Propeller Head
Posts: 7
Joined: Tue Sep 23, 2008 4:52 am

Re: How to remove UTF-8 BOMs at build time

Post by DeanCloutier »

I received a response from MadCap Technical support. I thought I would share it here, in case it comes up for someone else later.
...This appears to be a bug related to the way that PHP handles the UTF-8 Byte Order Mark.

The quickest fix would be to rebuild PHP version 5 with the option --enable-zend-multibyte. This would make PHP handle the BOM correctly. Read more on that fix at this PHP bug: http://bugs.php.net/bug.php?id=22108

If you're using PHP 4 or otherwise cannot rebuild PHP, then you'll most likely need to use the Perl script available from this site:
http://rishida.net/blog/?p=102 ...
Our solution is that one of our developers wrote a script in PHP which can recursively strip out all BOMs from all files in a directory. Let me know if anyone wants more info on this.

Also, in my trials I discovered that MS Expression Web has a feature to allow one to remove the BOM from files; however the removal of BOMs was not reliably saved in each file. Programmers Notepad, on the other hand, reliably removed the BOM, and saved the file without the BOM consistently over many files, and many file types.

I would still rather control BOM inclusion or omission at build time in Flare, rather than requiring the development team to run processes on compiled projects.

An enhancement request has been raised by MadCap Technical support.
-Dean
Post Reply