Android Question GetBlob (SQL) has negativ values (I'm confused)

Karl Matzinger

Member
Licensed User
I'm confused: Bytearray from GetBlob (SQL) has negativ values
buffer=cCursor2.GetBlob("vBlob")
something like: -119,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,2,-68,0,0,2,-87,8,6,0,0,0,94,....

I want to tranfer the blob via json and there is service (vb.net) to handle the json.
But it can't handle negative Bytes.

What am I doing wrong?
Or what is the best way to transfer blobs via json?
 

OliverA

Expert
Licensed User
Longtime User
1) Base64 using StringUtils
B4X:
Dim su as StringUtils
Dim base64Buffer As String = su.EncodeBase64(Buffer)
2) Hex using ByteConverter
B4X:
Dim bc as ByteConverter
Dim hexBuffer as String = bc.HexFromBytes(Buffer)

For JSON, pick #1 (#2 just showing another way).
 
Upvote 0

Karl Matzinger

Member
Licensed User
I'm confused: Bytearray from GetBlob (SQL) has negativ values
buffer=cCursor2.GetBlob("vBlob")
something like: -119,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,2,-68,0,0,2,-87,8,6,0,0,0,94,....

I want to tranfer the blob via json and there is service (vb.net) to handle the json.
But it can't handle negative Bytes.

What am I doing wrong?
Or what is the best way to transfer blobs via json?


I think this is working - first test are good:
seems to bee a signed byte - the following should convert to unsigned-byte (for ms sql server blobs)
IIf(i < 0, i + 256, i)
 
Upvote 0
Top