#30567 [NEW]: Problems encoding to utf8 when adding an entry into the LDAP
| From: | leticia dot borrajo at gmail dot com | Date: | Tue, 26 Oct 2004 16:17:05 +0000 |
| Subject: | #30567 [NEW]: Problems encoding to utf8 when adding an entry into the LDAP | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-68103@lists.php.net to get a copy of this message | ||
From: leticia dot borrajo at gmail dot com
Operating system: Linux Fedora Core 1
PHP version: 4.3.8
PHP Bug Type: LDAP related
Bug description: Problems encoding to utf8 when adding an entry into the LDAP
Description:
------------
We work with OpenLDAP 2.1.22 and PHP 4.3.8
I'm working in a set of applications to manage our LDAP directory.
We archive into the LDAP information about users, and need to save spanish
characters, such as "á", "ñ",...
So when I try to add an entry into the ldap, I apply "utf8_encode" to some
attributes. By the moment these attributes are: 'cn', 'sn' and
'gecos'.
When this happens, I have 2 problems:
1. In 'sn' there use to be 2 words, first surname and second surname, and
after apply utf8_encode, it deletes the second surname.
2. When I try to add the entry into the ldap, I get an error and it can't
be done
Any idea?
Reproduce code:
---------------
The code is this:
$info['uid']=$uid;
$info['cn']=utf8_encode($cn);
$info['sn']=utf8_encode($sn);
$info['userPassword']="{MD5}".base64_encode(pack("H*",md5($clave)));
$info['gecos']=utf8_encode($gecos);
$info['ou']=$ou;
$ds=ldap_connect($servidor);
if($ds) {
$user="cn=Administrador,o=ou.uvigo.es";
$r=ldap_bind($ds,$user,$cla);
if ($r)
{
$añade= ldap_add($ds,$usuario,$info);
...
}
}
Expected result:
----------------
If everything were ok, I would see "Usuario añadido con éxito". Instead of
that I only get "Invalid syntax".
Actual result:
--------------
The actual result is:
Warning: ldap_add(): Add: Invalid syntax in
/var/www/html/proyecto/crear_usuario.php on line 70
--
Edit bug report at http://bugs.php.net/?id=30567&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30567&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30567&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30567&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30567&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30567&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30567&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30567&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30567&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30567&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30567&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30567&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30567&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30567&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30567&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30567&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30567&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30567&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30567&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30567&r=mysqlcfg