Thanks for the pointer. I was actually already aware of the rfc, what has been giving me a great deal of grief has been implementing it. So escaping these characters sound sreal easy until you see that it: - Must be escaped for LDAP. - Then must be escaped again for the API (at least for JNDI). - Then because it's used in a string in Java it must be escaped again.
So 1 \ character turns into 8. I there an easier way to handle this? The escaping information I got from SUN's site: http://java.sun.com/products/jndi/tutorial/beyond/names/syntax.html Any help or advice would be greatly appreciated, James -----Original Message----- From: Ivailo Iliev [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 4:07 AM To: Chamberlain, James O. CONTR J9C998 Subject: Re: problems escaping characters in dn using java sdk RFC 2254.. not bad ideq to escape symbols before entering in server too. ----- Original Message ----- From: "Chamberlain, James O. CONTR J9C998" <[EMAIL PROTECTED]> To: <mozilla-directory@mozilla.org> Sent: Tuesday, February 01, 2005 7:35 AM Subject: problems escaping characters in dn using java sdk > Hi, > > I am trying to use a dn which has special characters in it within a > filter. > > The special characters that I am told to expect include \/,()-_." > > I am trying to use this filter to determine group membership for the > user. > > A typical dn might be something like: cn=Smith\, James //Captain > (level1), ou=users, dc=company, dc=com > > Escaping this has turned out to be a nightmare :-( > > Whenever I try to escape the comma with backslashes I always get a > > netscape.ldap.LDAPException: Bad search filter (89); Bad parameter to an > LDAP method > at > netscape.ldap.LDAPConnection.sendRequest(LDAPConnection.java:1804) > at netscape.ldap.LDAPConnection.search(LDAPConnection.java:2520) > at netscape.ldap.LDAPConnection.search(LDAPConnection.java:2402) > at Tester.<init>(Tester.java:108) > at Tester.main(Tester.java:163) > > Does anyone have any advice for escaping special characters using the > netscape LDAP API? > > - James > > _______________________________________________ > mozilla-directory mailing list > mozilla-directory@mozilla.org > http://mail.mozilla.org/listinfo/mozilla-directory > _______________________________________________ mozilla-directory mailing list mozilla-directory@mozilla.org http://mail.mozilla.org/listinfo/mozilla-directory