Ask a Question

Nead to write utf8 Without BOM

Occasional Contributor

Nead to write utf8 Without BOM



I need to read / Write into a textfile on utf-8 but without bom. Actually, if a use Writetotextfile with textencodingType 22 or aqfile.ctUTF8, my file have a BOM... when my application read this BOM... it BOOOOOM.


it is possible to read/write without this Bom ?





Esteemed Contributor

Rather than using the aqFile.OpenTextFile, etc., you could instantiate the FileSystemObject yourself an use it's native functions (aqFile and aqFileSystem provide wrappers around those methods). 

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
SmartBear Alumni (Retired)

Hi Fabrice,


Both aqFile* and Scripting.FileSystemObject write UTF-8 files with BOM.


To write a file without BOM, you can use this workaround that involves two ADO Stream objects:

The example is in VBScript, but the code can be ported to other languages.


Another way is to use the .NET method System.IO.File.WriteAllText(), which by default uses UTF-8 encoding without BOM. You will need to add the System.IO assembly to project properties > CLR Bridge.

dotNET.System_IO.File.WriteAllText("C:\\no_bom.txt", "привет");

Helen Kosova
SmartBear Documentation Team Lead
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Occasional Contributor

Hi all,


Thanks for your responses...


dotNET.System_IO.File.WriteAllText("C:\\no_bom.txt", "привет");

It works fine, thanks again



Showing results for 
Search instead for 
Did you mean: