ADBlock is blocking some content on the site

ADBlock errore

How do I set the byte order marker for Unicode files?

StackOverflow https://stackoverflow.com/questions/200689


I know this is not a "real" programming question. But, it relates to programming so I am going to set it anyway. I have a program that I need to test that reads the Byte Order Marker of the file to see if it is utf-8 or utf-16. My problem is I cannot find a program/text editor that will allow me to set the byte order marker. Can anybody tell me how to set this in a text file?


There is a pretty good program called BabelPad. It will not only set the BOM, I believe it will also tel you if it is set or not. You can also do it programmitically in .Net. There is a good FAQ about this on MSN.


If you need to be absolutely sure what's going on, create the files in binary, either using a binary hex editor or writing it out from a program.

Ultra Edit or Notepad++ should both be able to do it, and edit the raw hex too (via a plugin with np++)

You should be able to see and edit this in Visual Studio.NET if you have it.

Bring up the open file dialog in Visual Studio. Click the little triangle on the Open button, and select Open With. Now select binary editor.

You should be able to edit the hex values at the beginning of the file to include any byte order pattern you need.

This Wikipedia article describes what you will need to set the byte order markers to be for the different file formats (UTF-8 or UTF-16 for example)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow