[Zope] how to display hex data ?

Jose Soares jose@sferacarta.com
Mon, 09 Apr 2001 09:46:06 +0200


Yes Dieter.
Seems this works but there is still a problem
your function returns only 9 digits insted of 16.

original data               data converted
==============    ===========
ec00000002000000   ec0002000
ec00000002000400   ec0002040
ec00000002000500   ec0002050
ec00000002000600   ec0002060
ec00000002000700   ec0002070
ec00000002000b00   ec00020b0

What can I do to change this behavior ?
Thank you.



Dieter Maurer wrote:

> Jose Soares writes:
>  >       OID        DISTRETTO
>  > ================ =========
>  > a200000002000100 I10500
>  >
>  > but Zope display it as:
>  >
>  > OID      DISTRETTO
>  > -------------------------
>  > ¢     I10500
>
> Apparently, your database does not send the OID as a hexadecimal
> string but as a binary string.
>
> You could convert the binary string into a hexadecimal string
> in an External Method:
>
>    from string import join
>
>    def convertBinaryToHexString(binstring):
>        return join(map(lambda c: '%x' % ord(c), binstring), '')
>
> Dieter