PB4 Win32 - bug or feature in saved v4 sources

Everything else that doesn't fall into one of the other PB categories.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

PB4 Win32 - bug or feature in saved v4 sources

Post by va!n »

While taking a look to some saved sources with PB4 final i noticed something mysterious in the header of saved sourcecodes. the first 3 bytes of those pb source files are defined by follwing, $EF $BB $BF followed by the normal source :roll:

If you try to load the source into v4 IDE, the first 3 mysterious chars (bytes) are not visible (cutted off) ... if you try to load the source into IDE v3.x you will see "  "

someone an idea?
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

This is the BOM-Header for UTF-8 Files. Is a feature, not a bug :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

It is, I think, conforming to the standards, so not a bug but actually right on the button?
Dare2 cut down to size
inc.
Enthusiast
Enthusiast
Posts: 406
Joined: Thu May 06, 2004 4:28 pm
Location: Cologne/GER

Post by inc. »

http://en.wikipedia.org/wiki/Byte_Order_Mark
... as a marker to indicate that text is encoded in UTF-8, UTF-16 or UTF-32. ...
Its also supported by PB4s File commands as

ReadStringFormat() and WriteStringformat().

If using Readstringformat() as first on an opened text file and when the result is one of the PB UTF Codes the filepointer will be set behind the BOM marker, otherwise the filepointer wont be forwarded, means will be kept at the position before the Readstringformat() call. So using that command on an opened textfile is never bad ;) . This makes secure how to read properly the following character content by using the readstring commands with the needed flag
Check out OOP support for PB here!
Post Reply