Got quite a few php files that I think may have boms in them, but can’t be definite. Are there any free programmes that can physically check files for boms please ?
TBH I don’t know why editors even have that option for UTF-8 as it’s not needed. UTF-16, UTF-32, yes, but not UTF-8. It’s not needed to indicate endianess as UTF-8 doesn’t have endianess and it causes problems for plenty of people when the BOM is used. So yes, don’t save UTF-8 with a BOM
I assume the best way is to save files as UTF-8 without the byte-order-mark (BOM)?
I just want to be sure. Right now, my PHP, HTML, JS, and CSS files are all saved in the UTF-8 Without BOM format.
Brilliant, many thanks Mittineague - all solved
Looking again, I notice it’s “apply to opened ANSI” files, but the path is
Settings -> Preferences -> New Document -> Encoding
Thanks for all the info so far, it’s appreciated. One thing, wheres the settings to ‘to convert opened files to UTF-8 without a BOM.’ please ? Have looked thru the program but can’t seem to find it.
Thanks Mittineague - it’s appreciated. Has anyone used any of these scripts and / or tools that they can recommend please ?
I did a search and saw some Perl and PHP code examples. Not tools, but you could run the Perl or put the PHP code into a recursive directory script and run it I suppose. I don’t know how large and complex your folder structure is or how many files you’re talking about. So it could take a while and/or tie up some memory. Essentialy they can either “flag” the files with BOMs or rewrite the file without the leading BOM.
Thanks for not dropping too many boms on me :D, but are there any free programmes that can physically check files for boms please ?
Sorry, I haven’t. I use Notepad++ with the settings to save files as UTF-8 without a BOM and to convert opened files to UTF-8 without a BOM.
Even though it isn’t foolproof or a “batch” process it’s worked OK for me so far.
Hopefully none of my older not-being-worked-on-now files have this problem, though I imagine I would heve noticed by now if they did.
I don’t mean to drop a bom on you ( ) but here are some links that might help: