On Sep 28, 2006, at 4:43 PM, Alexander Foken wrote:
The function Net::LDAP::Filter::_escape($) does exactly what is
needed here. It is not exported, not documented, and it seems to be
a private function, but as Perl is not Java, you can use it. (But
be aware that _escape() may disappear or change its behavior. In
the worst case, copy that single-line function into your code.)
But in Net::LDAP::Util you will find
=item escape_filter_value ( VALUES )
Escapes the given B<VALUES> according to RFC 2254 so that they
can be safely used in LDAP filters.
Any control characters with an ACII code E<lt> 32 as well as the
characters with special meaning in LDAP filters "*", "(", ")",
and "\" the backslash are converted into the representation
of a backslash followed by two hex digits representing the
hexadecimal value of the character.
Returns the converted list in list mode and the first element
in scalar mode.
Graham.