Ldap module and base64 oncoding

Michael Ströder michael at stroeder.com
Sun May 26 11:07:35 EDT 2013


Joseph L. Casale wrote:
> I have some data I am working with that is not being interpreted as a string requiring
> base64 encoding when sent to the ldif module for output.
> 
> The base64 string parsed is ZGV0XDMzMTB3YmJccGc= and the raw string is det\3310wbb\pg.
> I'll admit my understanding of the handling requirements of non ascii data in 2.7 is weak
> and as such I am failing at adjusting the regex that deduces is the string contains characters
> requiring base64 encoding when being output.

I'm not sure what exactly you're asking for.
Especially "is not being interpreted as a string requiring base64 encoding" is
written without giving the right context.

So I'm just guessing that this might be the usual misunderstandings with use
of base64 in LDIF. Read more about when LDIF requires base64-encoding here:

http://tools.ietf.org/html/rfc2849

To me everything looks right:

Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 'ZGV0XDMzMTB3YmJccGc='.decode('base64').decode('utf-8')
u'det\\3310wbb\\pg'
>>>

What do you think is a problem?

Ciao, Michael.




More information about the Python-list mailing list