title: How to construct search filter for a java ldap search api ,when object name has single or double quote in it
body: <p>I have an object, <code>cn=abc"and'def</code> in the directory. I am using the Java search API:</p>
  
  <pre><code>public LDAPSearchResults search(java.lang.String base,
      int scope,
      java.lang.String filter,
      java.lang.String[] attrs,
      boolean typesOnly,
      LDAPSearchConstraints cons)
      throws LDAPException
  </code></pre>
  
  <p>I tried giving the search filter as <code>abc"and'def</code> and also as <code>abc\"and\'def</code>. Both return:</p>
  
  <blockquote>
    <blockquote>
      <p>Bad search filter</p>
    </blockquote>
  </blockquote>
  
  <p>Please help me as to how to construct the search filter when the object name has single or double quote in it.</p>