No BOM detected

Just starting out? Need help? Post your questions and find answers here.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

No BOM detected

Post by IdeasVacuum »

If ReadStringFormat() does not find a BOM, a format of #PB_Ascii is returned.

From the help:
"if no BOM is detected at the start of a file, it does not necessarily mean that it is a plain text file".
Indeed. I think ReadStringFormat() would serve better if it returned #PB_No_BOM rather than 'guessing' the file is #PB_Ascii, and #PB_Unknown_BOM if a detected BOM is unrecognised. I'm finding ReadStringFormat() is frequently returning #PB_Ascii when the file is UTF8, but without a BOM and I think this reflects the fact that Unicode text files are more prevalent today.

Edit: Not forgetting of course that UTF-8 is designed for backward compatibility with ASCII.

Edit: Related BOM issues:
http://www.purebasic.fr/english/viewtop ... 66#p433766
http://www.purebasic.fr/english/viewtop ... 13&t=55484
IdeasVacuum
If it sounds simple, you have not grasped the complexity.