We help IT Professionals succeed at work.
Get Started

LDAP SEARCH

1,232 Views
Last Modified: 2012-04-21
Hi People,

I want to list the users in AD 2003.

I'm using this code

 #!/bin/bash

LDAPSEARCH=/usr/bin/ldapsearch
FILTER="(&(sAMAccountName=*)(objectClass=user)(givenName=*))"
FIELDS="displayName"
 
 # Extract users from ADS
  echo -n "Quering ADS... "
  echo $($LDAPSEARCH -x -H $LDAP_SERVER -b $BASEDN -D "$BINDDN" -w $BINDPW "$FILTER" $FIELDS ) >> $ADS_TMP

When the displayName has any utf8 character like 'ç','á',é' the query return a code like

displayName:: Q0xFQkVSIEFOVMOUTklPIERBIFNJTFZB #

My locale is set like this:

LANG=pt_BR.UTF-8
LANGUAGE=pt_BR:pt:en
LC_CTYPE="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"


My SO is Debian6 or RHEL, I have tried in both SO, but it didn't work!

How I can convert this answer to utf8 code?
Comment
Watch Question
sysadmin
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE