InvalidAttributeValueException when using non-ascii characters in JNDI
Posted
by matdan
on Stack Overflow
See other posts from Stack Overflow
or by matdan
Published on 2010-05-04T12:04:35Z
Indexed on
2010/05/04
12:08 UTC
Read the original article
Hit count: 358
Hi,
I have some trouble using JNDI since it accepts only 7-bits encoded parameters.
I am trying to change an LDAP entry using JNDI with the following code :
Attribute newattr = new BasicAttribute("userpassword", password);
ModificationItem[] mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, newattr);
context.modifyAttributes("uid=anID,ou=People,o=MyOrganisation,c=com", mods);
If my password contains only ascii characters, it works perfectly, but if I use a non-ascii character, like "à", I have this error message :
javax.naming.directory.InvalidAttributeValueException:
[LDAP: error code 19 - The value is not 7-bit clean: à];
My ldap supports those characters so I guess it comes from JNDI.
Does anyone know how to fix that? Am I supposed to convert my parameter? How can I do that easily?
Thanks
© Stack Overflow or respective owner