Skip to content

Instantly share code, notes, and snippets.

@jaredh159
Created October 14, 2019 18:52
Show Gist options
  • Save jaredh159/1103b1ae49d1aa33fbdd7130ca7b6463 to your computer and use it in GitHub Desktop.
Save jaredh159/1103b1ae49d1aa33fbdd7130ca7b6463 to your computer and use it in GitHub Desktop.
BOM byte order mark troubles

check web url through this service:

https://validator.w3.org/i18n-checker/check

like:

https://validator.w3.org/i18n-checker/check?uri=https%3A%2F%2Fmadameaphotographie.fr%2F#validate-by-uri+

It should show NO BOM.

If you download a file, you can check for the presence of a BOM by doing:

hexdump -n 3 -C filename.jpg

if you see "ef bb bf" you've got a BOM.

to remove a bom, use tail

tail -c +4 bad.jpg > better.jpg

Here's some PHP to test whether the wp-config.php has a BOM:

	$contents = file_get_contents(dirname(__FILE__) . '/wp-config.php');
	if (substr($contents, 0, 3) == "\xef\xbb\xbf") {
		echo 'CONFIG HAS IT!';
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment