Automatic BOM

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Automatic BOM

Post 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
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Automatic BOM

Post 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!".
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Automatic BOM

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Automatic BOM

Post 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.
Post Reply