:: SN VIA PHP FUNCTIONS ::
DATA:
file: test-ldap.php
line: 46
string 'Jean-No�el' (length=10)
:: SN VIA EXEC CALL AND BASE64_DECODE ::
DATA:
file: test-ldap.php
line: 47
string 'Jean-Noël' (length=10)
:: mb_detect_encoding(Jean-No�el) ::
DATA:
file: test-ldap.php
line: 54
string 'UTF-8' (length=5)
:: base64_encode(Jean-No�el) ::
DATA:
file: test-ldap.php
line: 57
string 'SmVhbi1Ob8hlbA==' (length=16)
:: base64_encode(Jean-Noël) ::
DATA:
file: test-ldap.php
line: 58
string 'SmVhbi1Ob8OrbA==' (length=16)
For reference… all attribute entries with special characters (i.e. french special characters in this case) get encoded as base64 when inserted into our LDAP server.
Can’t figure this out for the life of me. Something is happening when PHP is decoding base64_encoded entries when using PHP’s built-in LDAP functions.
As you can see from the above dump, if I get a result containing a special character back from the LDAP server using the built-in PHP LDAP functions it does not decode the character correctly. If I do a query on the LDAP server using exec() and then run base64_decode against the entry the characters come out fine?!?!
Have any of you run into this?
Edit: Added the two base64_encode examples. They are showing up differently so PHP is clearly decoding the entry differently than it should be when using the ldap functions. The crappy part is I can’t identify a way to tell the PHP functions to simply not decode those entries and let me handle it.