Guy123
Guy123

Reputation: 1

Remove BOM from html files - 1,000s of files/ Can I remove with regex or apache?

I have 1,000's of HTML files all with BOM at the beginning. When a page loads in the browser it displays chinese looking charecters.

My question - is there a way to remove BOM from the beginning of my html files using find and replace with regex in Dreamweaver?

If not, any other solutions would be great I just need the pages to display properly in a browser. At this point I am open to anything - including anything I could do with apache. Please keep in mind I am not a developer.

Upvotes: 0

Views: 2450

Answers (1)

Mike G
Mike G

Reputation: 1986

I'm not sure if can do the find and replace within Dreamweaver but the expression to match the BOM character is \uFEFF

I have a gulp task which strips the characters. In JavaScript it's pretty easy to strip them from the string:

fileStr = fileStr.replace(/\uFEFF/g, '');

There is also also plugins for gulp that do this (as well as for Grunt). I'm not sure if that will work into your workflow or not.

Upvotes: 1

Related Questions