[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re[2]: Prob's with saving special Chars into LDAP under PHP
Guten Tag Herr Venaas,
Dienstag, 12. Juni 2001, 10:56:11, schrieben sie:
SV> On Tue, Jun 12, 2001 at 09:43:28AM +0200, Felix Meulenkamp wrote:
>> My Prob... I'm adding ldap-entrys utf8-encoded to the db, but i have
>> probs to add them to utf8-encoded DNs like:
>> cn=Mike Müller, o=My Org, c=de
>> But after saving, it looks like:
>> cn=Mike M?ller, ...
>> And... I can add attributes with a utf8-encoded value, but not with
>> many encoded values ...
SV> Are you sure it isn't just your LDAP client that displays it as ?, I
SV> find it hard to believe that PHP actually stores it as a ?. I'm not
SV> sure what you mean by the last comment.
I use this function for en- and decoding the result arrays and new
entries...
function code_a($array,$func="de"){
// Function ruft für jedes Value die En- oder Decoder function auf
// function calls for every leaf in the tree the en- or
// decoder
if (strtolower($func)=="en"){
$coder = "utf8_encode";
}elseif (strtolower($func)=="de"){
$coder = "utf8_decode";
}
$tmp="";
if (!is_array($array))return $coder($array);
else {
while (list($key, $val) = each ($array)){
$tmp[$key]=code_a($val,$func);
}
return $tmp;
}
}
... if i run this on the DN (cn=Frank Schäfer,...), the script saves
the entry at cn=Frank Sch?fer,...
(My LDAP-Browser (in JAVA on Win), PHP and ldap_search under Linux display it like this)
I'm using this line to save the entry:
$r=ldap_add($this->ser[ds],$dn,$ldap_ent);
...it's wrapped in a method (called add()) in a bigger connection-object
$this->ser[ds] hold the LDAP-link and $ldap_ent and $dn was encoded
with code_a()
>> Q: What to do for saving many special-chars-strings for one attribute?
SV> So you have multiple values where at least two have non-ascii characters?
... i've multiple values with at least one value with special chars...
like "ä","ü" or "ö"
... i'm using also code_a() here, so i'm using the same pice of code here
>> I'm running PHP 4.0.4pl1 and Open-LDAP 2.0.7.
>> ...perhaps this behavior depends on a bug..?
SV> If you could send me a smallest possible PHP script that shows the bad
SV> behavior, I'll try it out and fix the bug, or if there is no bug tell
SV> you why.
... I'll trying to extract some code snipplets for you...
Mit freundlichen Grüssen
Felix Meulenkamp
---------------------------------------------------
KDT Klaus Daten- und Telekommunikationstechnik GmbH
Ein Unternehmen der Ision Internet AG, Hamburg
Robertstrasse 6 * D-42107 Wuppertal, Germany
tel +49 202 495-362 mailto:meulenkamp@kdt.de
fax +49 202 495-399 http://www.kdt.de