eldap compatibility with Unicode strings

Guilherme Andrade <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAA5f+NXqKZPg+5sPYX3z-7jMr7bv1dforYjv-Qn_6ecaO=sqfQ@mail.gmail.com>
Hello,

Can eldap handle Unicode strings (e.g. passwords) in general?

I'm not in a position to test it myself as of this moment, and so I looked
into the source code.

- the eldap docs say the API mostly receives the built-in `string()` type
as input(s)[1]
- the `string()` type is defined as being a list of `char()`, which in
return is defined as a Unicode codepoint[2]
- eldap uses a module named ELDAPv3 to encode LDAP messages[3]
- ELDAPv3 appears to be generated from an ASN.1-defined protocol[4]
- under said protocol, most messages appear to transport "OCTET STRING"s[5]
- there's also an LDAPString[6] type, which is nevertheless also defined as
an "OCTET STRING"[7]
- finally, there's a separate notion of character strings under the docs
for the asn1 app[8], which is not used in eldap

With all of this in mind: would eldap handle Unicode strings? Or would I
have to convert them to UTF-8 encoded byte lists first?

(The later notion not being ideal, since they would be neither Unicode
strings nor UTF-8 binaries, but something in-between which is unsupported,
I presume, by both the `string` and `unicode` modules.)

[1]: http://erlang.org/doc/man/eldap.html#simple_bind-3
[2]:
https://erlang.org/doc/reference_manual/typespec.html#types-and-their-syntax
[3]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/src/eldap.erl#L1008
[4]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1
[5]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1#L148-L155
[6]:
https://github.com/erlang/otp/blob/OTP-23.3.1/lib/eldap/asn1/ELDAPv3.asn1#L42-L43
[7]: Expected to be encoded in UTF-8 no less
[8]:
http://erlang.org/doc/apps/asn1/asn1_getting_started.html#character-strings

--
Guilherme
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.