[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Base64 Encoding?

"Doyon, Jean-Francois" wrote:
> > "Doyon, Jean-Francois" wrote:
> > >
> > > Now the slapadd command is choking on Base64 encoded attributes! Take
> > the
> > > following entry (With sensitive data altered):
> > > [..]
> > > street:: NjE1LCBydWUgQm9vdGgsIDZl98l0YWdlLCBwaehjZSA2NTA=
> >
> > It's choking on your NON-ASCII data which seems to be some
> > ISO-charset.
> > It has to be UTF-8 encoded Unicode.
> I'm not sure I understand.  This string as a Base64 encoded version
> of the ACTUAL content.

Yes. But the "ACTUAL content" has to be UTF-8 encoded Unicode.

> I'd expect slapadd to detect this (By seeing the "::") and decoding it
> before inserting into the database.


> The decoded string is probably just tsraight text, but that was
> lead with a space or something.  It's not binary data that's for sure.

It depends how you define the terms "straight text" and "binary
data" in this context. It is not ASCII data that's for sure.

> The street attribute is indeed SYNTAX'ed as a UTF-8 Encoded
> string, but that doesn't mean that it couldn't be Base64
> encoded first...

Yes. It *must* be UTF-8 but it's not. Hell, let's look at it:

$ python -c "import
Traceback (most recent call last):
  File "<string>", line 1, in ?
UnicodeError: UTF-8 decoding error: invalid data
$ python -c "import base64;print
'615, rue Booth, 6e\xf7\xc9tage, pi\xe8ce 650'

> Are you suggesting slapadd doesn't detect the "::" and
> Base64 encoding, and
> therefore expects a straight UTF-8 string?


Ciao, Michael.