0

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.

Guy123
  • 1
  • 3
  • Not sure what you mean "What BOM" sorry - I dont know too much about BOM other than it messes up my pages ? Microsoft Excel was used to originally create the pages using a macro. Thank you - I will try it! – Guy123 Feb 04 '15 at 15:39
  • Try at a backuped file if `^\xEF\xBB\xBF` (match UTF-8 BOM) would do it. See here [different BOMs](http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding). – Jonny 5 Feb 04 '15 at 15:45
  • If the files are UTF-8 then you should serve the files as such: [how to change the default encoding to UTF-8 for server](http://stackoverflow.com/a/913885/1115360). – Andrew Morton Feb 04 '15 at 21:37

1 Answers1

1

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.

Mike G
  • 1,956
  • 1
  • 30
  • 62