Re: Data Maker for OS X & Windows
Posted: Sun Dec 10, 2017 10:23 pm
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.
http://www.purebasic.com
https://www.purebasic.fr/english/
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
I think this does the same as using -1 for length.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.
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
Hello wilbert!wilbert wrote: I think this does the same as using -1 for length.
It's just luck the data is followed by a 0.J. Baker wrote:When you use MemoryStringLength() it returned 320 bytes
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
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.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?
Will think on it. Thanks for the information.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.