Page 1 of 1

Automatic BOM

Posted: Mon Oct 21, 2013 2:40 am
by IdeasVacuum
[PB5.20LTS]
If compiling in Unicode mode and a file is written, a BOM is automatically inserted - this really should not happen as many apps do not recognise BOM (it's use is commonplace, but not a standard). So, please let the developer decide whether or not a BOM should be written (as we can with WriteStringFormat()).

Related to No BOM Detected http://www.purebasic.fr/english/viewtop ... 13&t=55125
Related to BOM and ReadString http://www.purebasic.fr/english/viewtop ... 13&t=55484

Re: Automatic BOM

Posted: Mon Oct 21, 2013 3:54 am
by Little John
IdeasVacuum wrote:[PB5.20LTS]
If compiling in Unicode mode and a file is written, a BOM is automatically inserted
I can't confirm that. It does not happen here with PB 5.20 LTS 32-bit on Windows XP 32-bit.
This is my test code (compiled in Unicode mode):

Code: Select all

If CreateFile(0, "D:\Data\LJ\Desktop\Text.txt")
   WriteString(0, "Hello world!")
   CloseFile(0)
EndIf
Looking at the created file with a HEX viewer, I see no BOM or anything else but the text "Hello world!".

Re: Automatic BOM

Posted: Wed Oct 23, 2013 9:52 pm
by IdeasVacuum
You are right Little John, with that code snippet all is well. I will have to go back to the code that revealed the issue. With reference to the other posts I linked to, I do think this is an area that needs a bit of attention.

Re: Automatic BOM

Posted: Wed Oct 23, 2013 10:08 pm
by Little John
IdeasVacuum wrote:You are right Little John, with that code snippet all is well. I will have to go back to the code that revealed the issue.
Yes, please post (the decisive part of) that code here.