Ask a Question

aqFile.WriteToTextFile inserts 3 chars at begining

shrap
New Contributor

aqFile.WriteToTextFile inserts 3 chars at begining

Hi,

I have this simple code in JScript:

  aqFile.WriteToTextFile("c:\\tmp.txt","text",aqFile.ctUTF8);

and the result is attached. I guess it is a bug or am I missing something?



Regards

David
3 REPLIES 3
AlexKaras
Community Hero

Hi David,



These three bytes are a signature (http://en.wikipedia.org/wiki/Byte_order_mark) that the file is in Unicode format (as specified in your code). So the behaviour seems to be correct.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
shrap
New Contributor

Oops. I must look dumb now 😉 However, our application does not write BOM into UTF-8 files (since it is not mandatory) and thus when I compare such two files, these 3 chars are extra. I suppose there is no way how to tell TC not to write these 3 bytes, is it?
AlexKaras
Community Hero

Hi David,



Try

aqFile.WriteToTextFile("c:\\tmp.txt","text",aqFile.ctANSI);
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: