on 01-26-2015 12:59 PM
Hi,
i am just testing a migrated Powerbuilder application from PB 9.5 to 12.6. here we have some functionality to read data from a Blob and show it later on with a datawindow.
In this context i discover currently a strange behavior.
e.g.
// Get record type (1 Byte)
lstr_record.record_type = CharA(Blobmid(lb_block, 3))
This code is working in Powerbuilder 9.5 (only Char instead of CharA) and Powerbuilder 12.5 (which i tested some weeks ago), but in Powerbuilder 12.6 i get some strange chinese character.
I was trying to get deeper into the issue and have converted the Blob into Byte Array and i looked to the 3rd byte in above case and i got 67 = 43hex, which would be the expected character 'C'.
Is this a bug in Powerbuilder 12.6? Or what do i missing?
Hi Henning,
the problem seems to be the implicit conversion from a Blob with length 1 to an integer. Try to add a lblb_00 which is declared as "blob{1} lblb_00".
... = charA( BlobMid( lb_Block, 3, 1 ) + lblb_00 )
charA() takes a string or an integer, in this case obviously an integer and an integer is 2 bytes long.
HTH
Bernhard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bernhard,
i did not tried yet you suggestion, but i found now another way, which works fine.
Solution looks like this:
// Get record type (1 Byte)
lstr_record.record_type = String(Blobmid(lb_block, 3,1), EncodingANSI!)
This will solve my issue, but anyway strange to see, that code, which is working in Powerbuilder 9.5 and Powerbuilder 12.5, is not working anymore in Powerbuilder 12.6.
Regards
Henning
Hi Henning;
FWIW: If this exact code worked in PB 12.5.x then I suspect that its a bug in PB 12.6 as the code base between the two PB versions should be the same - AFAIK.
Just for interest sake though, can you try ...
lstr_record.record_type = CharA ( Blobmid ( lb_block, 3, 1 ) )
Regards .. Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
That i tried too, same result
This code does not work:
// Get record type (1 Byte)
lstr_record.record_type = CharA(Integer(Blobmid(lb_block, 3,1)))
This code gives the expected result !!!
Byte lb_byte[]
lb_byte = getByteArray(Blobmid(lb_block, 3, 1))
lstr_record.record_type = CharA(Integer(lb_byte[1]))
It looks, really like a bug. For me it seems to be, that CharA reads 2 bytes instead of only one
Henning
User | Count |
---|---|
81 | |
11 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.