<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reading BLOBs-- byte array returns improper bytes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1343540#M69073</link>
    <description>&lt;P&gt;Hi all, I'm experimenting with reading a BLOB field.&lt;/P&gt;&lt;P&gt;I know the values that should be in it, however, they are wrong.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;\x00d\x00\x00\x00\x00  #100
\xe8\x03\x00\x00\x00 #1,000
\x10\'\x00\x00\x00 #10,000
\xa0\x86\x01\x00 #100,000
\x00@B\x0f\x00\x00 #1,000,000
\x80\x96\x98\x00\x00 #10,000,000
\x00\xe1\xf5\x05\x00 #100,000,000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The pattern appears to be 5 sets of bytes, the last of which is an empty separator (so 4 sets), then the bytes that are not empty are ignored and everything is read backwards. So, 1000 (\xe8\x03\x00\x00\x00) is read as '03e8'. Easy.&lt;/P&gt;&lt;P&gt;However.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does not work for 100, 10,000, or 1,000,000.&lt;/P&gt;&lt;P&gt;100 should be returned as \x64\x00\x00\x00\x00.&lt;/P&gt;&lt;P&gt;10,000 should be \x10\x27\x00\x00\x00&lt;/P&gt;&lt;P&gt;1,000,000 should be \x40\x42\x0f\x00\x00&lt;/P&gt;&lt;P&gt;The issues:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The separator between 100,000 and 1,000,000 appears to have been absorbed into the first byte of 1,000,000. Instead, we get this weird \x00@B\, which doesn't seem to mean anything.&lt;/LI&gt;&lt;LI&gt;Ditto for 100 and its preceding number; we instead get \x00d\. 0d is the number 13, so not sure where that came from.&lt;/LI&gt;&lt;LI&gt;10,000 just gives an apostrophe instead of a real value.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What is going on, and how can I reliably parse this byte array?&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2023 20:41:37 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2023-10-30T20:41:37Z</dc:date>
    <item>
      <title>Reading BLOBs-- byte array returns improper bytes</title>
      <link>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1343540#M69073</link>
      <description>&lt;P&gt;Hi all, I'm experimenting with reading a BLOB field.&lt;/P&gt;&lt;P&gt;I know the values that should be in it, however, they are wrong.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;\x00d\x00\x00\x00\x00  #100
\xe8\x03\x00\x00\x00 #1,000
\x10\'\x00\x00\x00 #10,000
\xa0\x86\x01\x00 #100,000
\x00@B\x0f\x00\x00 #1,000,000
\x80\x96\x98\x00\x00 #10,000,000
\x00\xe1\xf5\x05\x00 #100,000,000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The pattern appears to be 5 sets of bytes, the last of which is an empty separator (so 4 sets), then the bytes that are not empty are ignored and everything is read backwards. So, 1000 (\xe8\x03\x00\x00\x00) is read as '03e8'. Easy.&lt;/P&gt;&lt;P&gt;However.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does not work for 100, 10,000, or 1,000,000.&lt;/P&gt;&lt;P&gt;100 should be returned as \x64\x00\x00\x00\x00.&lt;/P&gt;&lt;P&gt;10,000 should be \x10\x27\x00\x00\x00&lt;/P&gt;&lt;P&gt;1,000,000 should be \x40\x42\x0f\x00\x00&lt;/P&gt;&lt;P&gt;The issues:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The separator between 100,000 and 1,000,000 appears to have been absorbed into the first byte of 1,000,000. Instead, we get this weird \x00@B\, which doesn't seem to mean anything.&lt;/LI&gt;&lt;LI&gt;Ditto for 100 and its preceding number; we instead get \x00d\. 0d is the number 13, so not sure where that came from.&lt;/LI&gt;&lt;LI&gt;10,000 just gives an apostrophe instead of a real value.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What is going on, and how can I reliably parse this byte array?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 20:41:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1343540#M69073</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-10-30T20:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BLOBs-- byte array returns improper bytes</title>
      <link>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1345699#M69138</link>
      <description>&lt;P&gt;Classic webdev blunder:&lt;/P&gt;&lt;P&gt;\x64 is the unicode hex for &lt;A href="https://www.codetable.net/hex/64" target="_self"&gt;small d&lt;/A&gt;&lt;/P&gt;&lt;P&gt;\x27 is the unicode hex for &lt;A href="https://www.codetable.net/hex/27" target="_self"&gt;apostrophe&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;However you're reading the BLOB field data is for some reason parsing the bytes as Unicode characters.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 18:25:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1345699#M69138</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2023-11-03T18:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BLOBs-- byte array returns improper bytes</title>
      <link>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1345709#M69142</link>
      <description>&lt;P&gt;That's what I figured out, yeah. Ended up returning as string so I could parse the hex instead of trusting returnasbinary to give me values I can trust.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 18:35:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/reading-blobs-byte-array-returns-improper-bytes/m-p/1345709#M69142</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-11-03T18:35:41Z</dc:date>
    </item>
  </channel>
</rss>

