There are errors on http://java.sun.com/products/jndi/tutorial/beyond/names/syntax.html. Not all \ should be escaped.
According to javadoc of CompositeName [1]:
The JNDI syntax defines the following meta characters:
* escape (backward slash \),
* quote characters (single (') and double quotes (")), and
* component separator (forward slash character (/)).
Any occurrence of a leading quote, an escape preceding any meta
****************************
character, an escape at the end of a component, or a component
*********
separator character in an unquoted component must be preceded by
an escape character when that component is being composed into a
composite name string.
This means a CN attr of backslash\a should have LDAP name cn=backslash\\a, but its JNDI name should be cn=backslash\\\a. Only the escape itself (the first \) is to be escaped again. The second \, which is in the original content, is not an escape.
[1] http://java.sun.com/javase/6/docs/api/javax/naming/CompositeName.html
According to javadoc of CompositeName [1]:
The JNDI syntax defines the following meta characters:
* escape (backward slash \),
* quote characters (single (') and double quotes (")), and
* component separator (forward slash character (/)).
Any occurrence of a leading quote, an escape preceding any meta
****************************
character, an escape at the end of a component, or a component
*********
separator character in an unquoted component must be preceded by
an escape character when that component is being composed into a
composite name string.
This means a CN attr of backslash\a should have LDAP name cn=backslash\\a, but its JNDI name should be cn=backslash\\\a. Only the escape itself (the first \) is to be escaped again. The second \, which is in the original content, is not an escape.
[1] http://java.sun.com/javase/6/docs/api/javax/naming/CompositeName.html