troubleshooting Question

LDAP SEARCH

Avatar of Anderson Meneses
Anderson MenesesFlag for Afghanistan asked on
Linux NetworkingWindows NetworkingLinux
1 Comment1 Solution1234 ViewsLast Modified:
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?
ASKER CERTIFIED SOLUTION
Maciej S
sysadmin

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros