Data Maker for OS X & Windows

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

Glad to hear it's working for you. Will have to look into the extra 2 bytes for the uncompressed. Was watching a football game and haven't looked into that yet. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: Data Maker for OS X & Windows

Post by oO0XX0Oo »

Thanks for looking into this issue!

Code: Select all

464c9e2702eed27169e93782b5fadc01	D:\Development\PureBasic\Test XML UTF-8 BOM - NotepadPlusPlus.xml
464c9e2702eed27169e93782b5fadc01	D:\Development\PureBasic\Test XML UTF-8 BOM - Sublime Text.xml
464c9e2702eed27169e93782b5fadc01	D:\Development\PureBasic\Test XML UTF-8 BOM - Visual Studio Code.xml
All three items are binary identical (it's their md5 checksum)...

If you want my original file for further testing (zipped "Test XML UTF-8 BOM - Sublime Text.xml")
https://workupload.com/file/fNr5YcP
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

Cool, thanks! Will look into it in a bit. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

Ok, I opened your file in HyperEdit along with mine. Yours is the first (to the left) and mine on the right. You can see the difference. One thing you can not see, due to the screen capture app, is the cursor position. Yours is on line 14, which doesn't even exist and mine is at the end of line 13. You may want to try a different editor for your xml files.

Image
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: Data Maker for OS X & Windows

Post by oO0XX0Oo »

What you see there is the BOM header.
EF BB BF in hex.

It seems you've written your file in UTF-8 without BOM,
mine is with UTF-8 with BOM.

Image
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

Code removed.
Last edited by J. Baker on Mon Dec 11, 2017 8:33 am, edited 1 time in total.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Data Maker for OS X & Windows

Post by wilbert »

J. Baker wrote:You can get the MemoryStringLength() for uncompressed data and you do not have to use a -1 or set the memory length yourself. ;)
I think this does the same as using -1 for length.
Both PeekS with -1 for length and MemoryStringLength stop when a 0 is encountered to indicate the end of a string.
So both are only safe to use if you add a 0 to the uncompressed data.

Code: Select all

Debug PeekS(?Test_XML_UTF8_BOM_xml_start, -1, #PB_UTF8)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; size : 322 bytes
    Data.q $6C6D783F3CBFBBEF,$6E6F697372657620,$652022302E31223D,$3D676E69646F636E,$3F22382D46545522
    Data.q $746F6F523C0A0D3E,$7265562065646F4E,$2231223D6E6F6973,$6F72473C090A0D3E,$09090A0D3E737075
    Data.q $3E6563697665443C,$66453C0909090A0D,$0A0D3E7374636566,$3E6E4F3C09090909,$3C09090909090A0D
    Data.q $697461746F6E6E41,$65756C6156206E6F,$696620656854223D,$6E65766520747372,$6F6E206F64202C74
    Data.q $6D20646E69662074,$0A0D3E2F20222165,$6E4F2F3C09090909,$3C090909090A0D3E,$697461746F6E6E41
    Data.q $65756C6156206E6F,$6568746F6E41223D,$2C746E6576652072,$6E206C6C69747320,$6F2065687420746F
    Data.q $726120657720656E,$6863726165732065,$22726F6620676E69,$0909090A0D3E2F20,$7463656666452F3C
    Data.q $2F3C09090A0D3E73,$0D3E656369766544,$756F72472F3C090A,$522F3C0A0D3E7370,$3E65646F4E746F6F
    Data.b $0D,$0A,#Null
  Test_XML_UTF8_BOM_xml_end:

EndDataSection
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

wilbert wrote: I think this does the same as using -1 for length.
Hello wilbert!

When -1 was used on oO0XX0Oo's original posted data, it had the same effect as 322 bytes. When you use MemoryStringLength() it returned 320 bytes which oO0XX0Oo said fixed their problem. Using 2 less bytes. I would have assumed -1 had the same effect too but it is different. See this post on what I'm talking about... http://www.purebasic.fr/english/viewtop ... 11#p515611
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Data Maker for OS X & Windows

Post by wilbert »

J. Baker wrote:When you use MemoryStringLength() it returned 320 bytes
It's just luck the data is followed by a 0. :wink:
If there's other data in the data section, it won't work.

Code: Select all

Debug PeekS(?Test_XML_UTF8_BOM_xml_start, MemoryStringLength(?Test_XML_UTF8_BOM_xml_start, #PB_UTF8), #PB_UTF8)
Debug ""
Debug "Memory Length = " + MemoryStringLength(?Test_XML_UTF8_BOM_xml_start, #PB_UTF8)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; size : 363 bytes
    Data.q $6576206C6D783F3C,$31223D6E6F697372,$6F636E652022302E,$5455223D676E6964,$3C0A3E3F22382D46
    Data.q $65646F4E746F6F52,$6E6F697372655620,$20200A3E2231223D,$7370756F72473C20,$2020202020200A3E
    Data.q $3E6563697665443C,$202020202020200A,$63656666453C2020,$202020200A3E7374,$2020202020202020
    Data.q $2020200A3E6E4F3C,$2020202020202020,$6E6E413C20202020,$206E6F697461746F,$54223D65756C6156
    Data.q $7473726966206568,$202C746E65766520,$6620746F6E206F64,$2221656D20646E69,$202020200A3E2F20
    Data.q $2020202020202020,$20200A3E6E4F2F3C,$2020202020202020,$746F6E6E413C2020,$6156206E6F697461
    Data.q $6F6E41223D65756C,$6576652072656874,$6C697473202C746E,$687420746F6E206C,$657720656E6F2065
    Data.q $6165732065726120,$6620676E69686372,$200A3E2F2022726F,$2020202020202020,$7463656666452F3C
    Data.q $20202020200A3E73,$63697665442F3C20,$2F3C2020200A3E65,$0A3E7370756F7247,$6F4E746F6F522F3C
    Data.b $64,$65,$3E
  Test_XML_UTF8_BOM_xml_end:
  
  MyData:
    Data.l $4A6FF65
  
EndDataSection
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

I see. I figured it would only return per label. Not all the labels.

Should Data Maker end with a #Null then for each labels data?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Data Maker for OS X & Windows

Post by wilbert »

J. Baker wrote:I see. I figured it would only return per label. Not all the labels.

Should Data Maker end with a #Null then for each labels data?
It's only useful for text data. In case of ascii and utf8, 1 zero byte is required, in case of unicode, 2 zero bytes are required.
You could add a checkbox option to include two additional zero bytes after each file.
Another way would be to add a special option to add text. A sort of popup containing an EditorGadget where you can enter text and convert that and include the required string termination byte(s).
Or you can leave it as it is. :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Data Maker for OS X & Windows

Post by J. Baker »

wilbert wrote: It's only useful for text data. In case of ascii and utf8, 1 zero byte is required, in case of unicode, 2 zero bytes are required.
You could add a checkbox option to include two additional zero bytes after each file.
Another way would be to add a special option to add text. A sort of popup containing an EditorGadget where you can enter text and convert that and include the required string termination byte(s).
Or you can leave it as it is. :)
Will think on it. Thanks for the information. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
Post Reply