femtopixel/utf8-bom-fixer

Sponsored OSS

By FemtoPixel

Updated over 6 years ago

Fix files "infected" by UTF-8 BOM character

Image
Languages & frameworks
Integration & delivery
1

5.5K

femtopixel/utf8-bom-fixer repository overview

UTF-8 BOM Fixer

Minimum PHP Version Minimum PHP Version Minimum PHP Version Build Status Scrutinizer Code Quality Code Coverage license PayPal donation Buy me a coffee Buy me a coffee

Fix files "infected" by UTF-8 bom character. This script will remove the BOM character at the beginning of each files.

This character purpose is to force encode files in UTF-8 by adding a special character at the beginning of the file. Issues appears with this character on a web server because it might be interpreted (e.g : PHP files are not interpreted anymore)

Usage

php bomreplacer.php [[directory] [comma_separated_extensions]]

Parameters

optional directory (current directory if not specified) directory to recursively "heal" optional comma_separated_extensions (all if not specified) allowed extension a file must have to be "healed" (comma (,) separated)

Example

php bomreplacer.php /home/www

Will fix all files in /home/www folder

php bomreplacer.php /home/www php,css

Will fix all PHP and CSS files in /home/www folder but will leave the other files as-is.

Docker Usage

docker run --rm -ti -v "$PWD":/src femtopixel/utf8-bom-fixer

Will fix all files in your current path. You can call bomreplacer if you want to pass specific parameters

Example

docker run --rm -ti -v "$PWD:/src" femtopixel/utf8-bom-fixer bomreplacer /src php,css

Will fix all PHP and CSS files in current directory but will leave the other files as-is.

Tag summary

Content type

Image

Digest

Size

7.6 MB

Last updated

over 6 years ago

docker pull femtopixel/utf8-bom-fixer

This week's pulls

Pulls:

796

Last week