33 Votes

Remove Byte Order Mark from a large Number of Files

Question by Guest | 2024-05-02 at 11:41

I have edited the PHP files of one of my very large web projects using a text editor locally on my hard drive. Unfortunately, I noticed far too late that this editor wrote a Byte Order Mark (BOM) into every file when saving. This is now causing problems with the display of the pages on my server, so I would have to remove the BOMs from all affected files.

Unfortunately, there are a lot of files, so I don't feel like opening each one individually again with the editor just to change their format (especially since you can't recognize the affected files from the outside and therefore even all the files of the project would have to be re-opened). Therefore, I'm looking for a way to edit a large number of text files at once in order to delete their BOM / change their format.

3Best Answer3 Votes

This task can be carried out quickly and easily with any number of files at the same time using the program TextEncoder.

Simply follow the following steps:

  1. First, add all files whose byte order mark you want to remove to the file list in the program. In the file list, the column "BOM" shows you whether a file has a byte order mark or not. This way you can immediately see which files are affected.
  2. Next, activate the action "Encoding" on the right side of the program. If you only want to change the BOM, you can configure the options of this action as follows:
  3. Read as: Auto Detect
  4. Save as: Keep
  5. Write Byte Order Mark (BOM) into Files: No
  6. Finally, you can specify in the Storage Options whether you want to overwrite your original files or whether you want to save your changed files as new files with a new name or in a new folder.
  7. Then click on "Convert and Save" to delete the Byte Order Mark from all files in the file list at once.

Tip 1: If you have a very large web project with a lot of folders, you can alternatively also simply add all PHP files to the file list in the TextEncoder by right-clicking on the file list, entering the file extension "PHP" under "Filter" and then drag the total folder of the project onto the program.

Tip 2: If you don't want to change only the encoding and/or the byte order mark of a large number of text files simultaneously, you can also take a look at the TextConverter. In addition to changing the encoding, the TextConverter also allows you to edit many files at the same time.
2024-05-02 at 20:29

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.