Majed,
Sounds like a bug in your other app!
FFFE is the byte order mark of Unicode, it signifies to Unicode that the
bytes are little endian. While FEFF signifies to Unicode that the bytes are
big endian!
Notice that in your samples, FEFF is Big Endian
BIGENDIANUNICODE FEFF00480065006C006C006F00210021000D000A
...H.e.l.l.o.!.!....
, while FFFE is little endian:
UNICODE FFFE480065006C006C006F00210021000D000A00
..H.e.l.l.o.!.!.....
You can prevent the byte order mark from being written by creating a new
UnicodeEncoding object that you pass as the Encoding parameter of the
STreamWriter constructor.
Something like(untested):
' little endian, no byte order marks
Dim encoding As New UnicodeEncoding(False, False)
Dim stream as FileStream
Dim writer As New StreamWriter(stream, encoding)
Of course you will need to be certain that you other app does not have an
issue with little endian verses big endian Unicode characters.
Hope this helps
Jay