Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:44:27+00:00 2026-06-05T23:44:27+00:00

I am parsing XML, with simplexml_load_string() , and using the data within it to

  • 0

I am parsing XML, with simplexml_load_string(), and using the data within it to update Active Directory (AD) objects, via LDAP.

Example XML (simplified):

<?xml version="1.0" encoding="UTF-8"?>
<users>
    <user>Bìlbö Bággįnš</user>
    <user>Gãńdåłf Thê Gręât</user>
    <user>Śām Wīšë</user>
</users>

I firstly run an ldap_search() to find a single user and then proceed to change their attributes. Pumping the above values straight into AD, using LDAP, will result in some pretty mangled characters showing up.

For example: Bìlbö Bággįnš

I’ve tried the following functions, to no avail:

utf8_encode($str);
utf8_decode($str);
iconv("UTF-8", "ISO-8859-1//TRANSLIT", $str);
iconv("UTF-8", "ASCII//TRANSLIT", $str);
iconv("UTF-8", "T.61", $str);

Ideally, I don’t want to do any of these string conversions. UTF-8 should be fine, right?!

I’ve also noticed the following:
I have printed out the values to see how they come out. curl-ing the script in CLI will show the correct characters, but web browsers show the same as AD.

What’s going on? Should I be looking at something else, eg. URL encoding?
I’m hoping this is down to a simple mistake on my end.

EDIT:
I entered in these characters using AD admin GUI to see how they would come out. I can read them via LDAP fine. Correct characters are displayed when in a browser. curl-ing via CLI will show question marks instead of foreign characters. Passing one of these returned values into mb_detect_encoding() will return UTF-8.

I decided to immediately modify the same object by not writing in a new string, but just reversing the existing value and saving the object. This works fine – I see the correct value (reversed) in AD.

  • Developing on Mac OS X 10.7 Lion – PHP 5.4.3
  • Running production on: Red Hat 6 – PHP 5.4.3
  • AD server: Windows 2003

UPDATE:
After a few months, I was unable to find the answer/solution to this problem.
In the end, I went with replacing characters to their non-accented equivalent (NOT ideal, I know).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:44:28+00:00Added an answer on June 5, 2026 at 11:44 pm

    Are you using LDAP v3?

    ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
    

    LDAPv3 supports UTF-8 by default, which it expects requests and responses to be in by default. See here: http://technet.microsoft.com/en-us/library/cc961766.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am Parsing XML currently using: $data = simplexml_load_string($xmlFile); foreach($data->item as $key => $current){
I'm using SimpleXML for parsing XMl documents. I need to be able to read/update
Using simplexml_load_file(), if I'm parsing out XML and I get the following for image...
I am having some problems parsing this piece of XML using SimpleXML. There is
I am parsing an XML feed into a MYSQL table using simplexml_load_file(). Some of
I have an XML file that needs parsing in PHP. I am currenlty using
i have a multidimensional array. the array is returned by parsing xml using curl.
I am parsing xml file from url(in code below), using file_get_contents() function, and simpleXML,
I have home work for parsing XML This is the xml : <?xml version=1.0
I am doing this tutorial but with a diferent xml http://blog.insicdesigns.com/2009/03/parsing-xml-file-using-codeigniters-simplexml-library/ , but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.