|
From: Michael S. <mi...@st...> - 2009-06-09 19:37:51
|
Zhang Huangbin wrote:
> Zhang Huangbin wrote:
>>> Not sure what you really want to display and where.
>>>
>>> How about entry['jpegPhoto'][0].encode('base64') ?
>
> Still confused what data type it stored in LDAP.
> Already base64 encoded?
Please read my e-mails more carefully.
As said in <4A2...@st...> it's the raw binary JPEG
image data.
> Display entry['jpegPhoto'][0] directly, got error msg:
> ----
> 'ascii' codec can't decode byte 0x89 in position 0: ordinal not in
> range(128)
> ----
>
> How can i display it if i use 'content-type: image/jpeg' header?
Send the binary data directly. Don't try to (implicitly) convert
entry['jpegPhoto'][0] to a Unicode object. You might want to learn a bit
more about normal strings vs. Unicode objects, string coercion and how
to interpret exceptions like the one above before going any further.
Ciao, Michael.
|