Ede Wolf wrote:
Hello,
This is probably more a ldif than an OpenLDAP question, but still, maybe somebody knows
the answer: Is there a way to put multibyte characters into an attribute
value and let the server know, these are not to be treated literally, but are utf8
character encodings?
Strings in LDAPv3 are all UTF-8, by definition. This is in RFC4511 section 4.1.2.
I've tried to dig into rfc3629 and 4517, but those were above my capabilities.
It does of course work for the dn, it also works, if I provide base64 code to the
attributes, but is there a way, to directly put them into a ldif an let the
server know, these are character encodings?
Also, rfc2849 only talks about not line breaking multi-byte characters.
base64 encoding for LDIF values is mostly optional. As long as the string you're
entering doesn't have
embedded NUL or CR/LF characters, you don't need to use base64.
In this silly, but easy, example, both cn: and description: are entered literally, while
the dn words as intended:
dn: cn=A \F0\9F\99\82 Test,dc=example,dc=com
cn: A \F0\9F\99\82 Test
objectClass: person
sn: Test
description: %xF0%x9F%x99%x82 Test
This is about understanding, not about the intention, to really put a smily into a dn. I
am aware, this a potential recipe for disaster.
Also, I am aware, the OpenLDAP kindly adds a proper cn value anyway, but that does not
help here. And still would leave the description open.
Also, as mentioned before:
echo -en "A \xF0\x9F\x99\x82 Test" | base64
is a viable workaround, but a cumbersome one.
So maybe there is an easier way
Thanks
Ede
--
-- Howard Chu
CTO, Symas Corp.
http://www.symas.com
Director, Highland Sun
http://highlandsun.com/hyc/
Chief Architect, OpenLDAP
http://www.openldap.org/project/