Forum Moderators: phranque

Message Too Old, No Replies

Detect Byte Order Mark in text files?

How do you detect if BOM exists in a text file?

         

JAB Creations

8:16 am on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I have found a text editor that does not create BOM (Byte Order Mark) in text files and correctly displays all languages (instead of? for many Asian languages for example) that would otherwise plague most text editors.

So does anyone know how to detect if a BOM (Byte Order Mark) exists in a text file?

- John

tsalmark

4:06 am on Oct 21, 2006 (gmt 0)

10+ Year Member



The obvious answer is to use a hex editor. If you need to do this fairly regularly there maybe more user-friendly ways of doing that test.

JAB Creations

6:59 am on Oct 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not obvious enough, though I do have a Hex Editor in my applications installer directory anyway.

After testing the file out I saw the characters that I don't want to see. After doing a search for UTF-8 Text editor I immediately came across SuperEdi and love the fact that not only did it explicitly allow me to not use BOM (Byte Order Mark) when saving as UTF-8, saving files as UTF-8 by default in it's options, but also the fact that it's free! Absolutely essential to me as I program using XHTML 1.1 which requires the application/xhtml+xml mime. Oh happy day!

- John