Hi..
Im trying to get some information out of a windows sever 2003 chinese
active directory system
so let's say encoding is probably big5 or utf-8
what im doing is simliar to ldapsearch in shell with my python script
using python ldap module
the result is not the correct encoding..
i've look many places and tried many different encoding on the top of
the script #coding=big5 etc..
below is the wrong encoding output .. any help will be much
appreciated..
*** ldap://2134.localhost. com:389 - SimpleLDAPObjec t.set_option ((17,
3),{})
CN=江,OU=2134, DC=localhost,DC =com
{'accountExpire s': ['92233720368547 75807'],
'badPasswordTim e': ['12856601467234 3750'],
'badPwdCount': ['0'],
'cn': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'codePage': ['0'],
'company': ['\xe8\x8f\xaf\x e8\x81\xaf\xe7\ x94\x9f
\xe7\x89\xa9\xe 7\xa7\x91\xe6\x 8a\x80'],
'countryCode': ['0'],
'department': ['\xe7\x94\x9f\x e7\x89\xa9\xe7\ xa7\x91\xe6\x8a
\x80\xe8\x99\x9 5'],
'displayName': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'distinguishedN ame': ['CN=\xe6\xb1\x9 f\xe6\x9f\x8f
\xe5\xa3\x95,OU =300\xe7\xa7\x9 1\xe6\x8a
\x80\xe8\x99\x9 5,DC=localhost, DC=com'],
'givenName': ['\xe6\x9f\x8f\x e5\xa3\x95'],
'homeMDB': ['CN=\xe4\xbf\xa 1\xe7\xae\xb1\x e5\x84\xb2\xe5\ xad
\x98\xe5\x8d\x8 0 (MAIL),CN=\xe9\ xa0\x90\xe8\xa8 \xad\xe5\x84\xb 2\xe5\xad
\x98\xe7\xbe\xa 4\xe7\xb5\x84,C N=InformationSt ore,CN=MAIL,CN= Servers,CN=
\xe9\xa0\x90\xe 8\xa8\xad\xe7\x b3\xbb\xe7\xb5\ xb1\xe7\xae
\xa1\xe7\x90\x8 6\xe7\xbe\xa4\x e7\xb5\x84,CN=A dministrative
Groups,CN=local host,CN=Microso ft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'homeMTA': ['CN=Microsoft MTA,CN=MAIL,CN= Servers,CN=
\xe9\xa0\x90\xe 8\xa8\xad\xe7\x b3\xbb\xe7\xb5\ xb1\xe7\xae
\xa1\xe7\x90\x8 6\xe7\xbe\xa4\x e7\xb5\x84,CN=A dministrative
Groups,CN=local host,CN=Microso ft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'instanceType': ['4'],
'lastLogoff': ['0'],
'lastLogon': ['12859896506671 8750'],
'legacyExchange DN': ['/o=localhost/ou=ExchangAdmin/cn=Recipients/
cn=joechiang'],
'logonCount': ['33'],
'mDBUseDefaults ': ['TRUE'],
'mail': ['joechiang@loca lhost.com'],
'mailNickname': ['joechiang'],
'memberOf': ['CN=AllHQStaff, CN=Users,DC=loc alhost,DC=com'],
'msExchALObject Version': ['60'],
'msExchHomeServ erName': ['/o=localhost/ou=ExchangAdmin/
cn=Configuratio n/cn=Servers/cn=MAIL'],
'msExchMailboxG uid': ['2\x04\x116^\xf c%J\x87yi\xbdj^ \x1bl'],
'msExchMailboxS ecurityDescript or': ['\x01\x00\x04\x 80x
\x00\x00\x00\x9 4\x00\x00\x00\x 00\x00\x00\x00\ x14\x00\x00\x00 \x04\x00d
\x00\x01\x00\x0 0\x00\x00\x02\x 14\x00\x03\x00\ x02\x00\x01\x01 \x00\x00\x00\x0 0\x00\x05\n
\x00\x00\x00a\x 00n\x00x\x00/\x00C\x00N\x00= \x00C\x00o\x00n \x00f\x00i
\x00g\x00u\x00r \x00a\x00t\x00i \x00o\x00n
\x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 1\x05\x00\x00\x 00\x00\x00\x05\ x15\x00\x00\x00 \xd6\xb2i
\x1a^\xa7P\xcb\ xday
\x88\xa9\xf4\x0 1\x00\x00\x01\x 05\x00\x00\x00\ x00\x00\x05\x15 \x00\x00\x00\xd 6\xb2i
\x1a^\xa7P\xcb\ xday\x88\xa9\xf 4\x01\x00\x00'],
'msExchPolicies Included': ['{C96E41C5-C5D5-411B-8672-1A3B6602437F},
{3B6813EC-CE89-42BA-9442-D87D4AA30DBC}',
'{C96E41C5-C5D5-411B-8672-1A3B6602437F},
{26491CFC-9E50-4857-861B-0CB8DF22B5D7}'],
'msExchUserAcco untControl': ['0'],
'name': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'objectCategory ':
['CN=Person,CN=S chema,CN=Config uration,DC=loca lhost,DC=com'],
'objectClass': ['top', 'person', 'organizational Person', 'user'],
'objectGUID': ['\x13\xfa\xc2\x bb\x9e\xee|C\x9 d\xa8_\xea]\xef
\xc6\x90'],
'objectSid':
['\x01\x05\x00\x 00\x00\x00\x00\ x05\x15\x00\x00 \x00\xd6\xb2i\x 1a^\xa7P
\xcb\xday\x88\x a9u\x0c\x00\x00 '],
'primaryGroupID ': ['513'],
'proxyAddresses ':
['X400:c=TW;a= ;p=localhost;o= Exchange;s=joec hiang;',
'SMTP:joechiang @localhost.com'],
'pwdLastSet': ['12858767039656 2500'],
'sAMAccountName ': ['joechiang'],
'sAMAccountType ': ['805306368'],
'showInAddressB ook': ['CN=\xe5\x85\xa 8\xe5\x9f\x9f\x e9\x80\x9a
\xe8\xa8\x8a\xe 6\xb8\x85\xe5\x 96\xae,CN=All Global Address
Lists,CN=Addres s Lists Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe7\x87\x9 f\xe9\x81\x8b\x e8\x99\x95,CN=A ll
Address Lists,CN=Addres s Lists Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe7\x94\x9 f\xe7\x89\xa9\x e7\xa7\x91\xe6\ x8a
\x80\xe8\x99\x9 5,CN=All Address Lists,CN=Addres s Lists
Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe6\x89\x8 0\xe6\x9c\x89\x e4\xbd\xbf
\xe7\x94\xa8\xe 8\x80\x85,CN=Al l Address Lists,CN=Addres s Lists
Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'sn': ['\xe6\xb1\x9f'],
'textEncodedORA ddress':
['c=TW;a= ;p=localhost;o= Exchange;s=joec hiang;'],
'uSNChanged': ['22943844'],
'uSNCreated': ['21991450'],
'userAccountCon trol': ['66048'],
'userPrincipalN ame': ['joe@localhost. com'],
'whenChanged': ['20080624074423 .0Z'],
'whenCreated': ['20071205035154 .0Z']}
None
Im trying to get some information out of a windows sever 2003 chinese
active directory system
so let's say encoding is probably big5 or utf-8
what im doing is simliar to ldapsearch in shell with my python script
using python ldap module
the result is not the correct encoding..
i've look many places and tried many different encoding on the top of
the script #coding=big5 etc..
below is the wrong encoding output .. any help will be much
appreciated..
*** ldap://2134.localhost. com:389 - SimpleLDAPObjec t.set_option ((17,
3),{})
CN=江,OU=2134, DC=localhost,DC =com
{'accountExpire s': ['92233720368547 75807'],
'badPasswordTim e': ['12856601467234 3750'],
'badPwdCount': ['0'],
'cn': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'codePage': ['0'],
'company': ['\xe8\x8f\xaf\x e8\x81\xaf\xe7\ x94\x9f
\xe7\x89\xa9\xe 7\xa7\x91\xe6\x 8a\x80'],
'countryCode': ['0'],
'department': ['\xe7\x94\x9f\x e7\x89\xa9\xe7\ xa7\x91\xe6\x8a
\x80\xe8\x99\x9 5'],
'displayName': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'distinguishedN ame': ['CN=\xe6\xb1\x9 f\xe6\x9f\x8f
\xe5\xa3\x95,OU =300\xe7\xa7\x9 1\xe6\x8a
\x80\xe8\x99\x9 5,DC=localhost, DC=com'],
'givenName': ['\xe6\x9f\x8f\x e5\xa3\x95'],
'homeMDB': ['CN=\xe4\xbf\xa 1\xe7\xae\xb1\x e5\x84\xb2\xe5\ xad
\x98\xe5\x8d\x8 0 (MAIL),CN=\xe9\ xa0\x90\xe8\xa8 \xad\xe5\x84\xb 2\xe5\xad
\x98\xe7\xbe\xa 4\xe7\xb5\x84,C N=InformationSt ore,CN=MAIL,CN= Servers,CN=
\xe9\xa0\x90\xe 8\xa8\xad\xe7\x b3\xbb\xe7\xb5\ xb1\xe7\xae
\xa1\xe7\x90\x8 6\xe7\xbe\xa4\x e7\xb5\x84,CN=A dministrative
Groups,CN=local host,CN=Microso ft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'homeMTA': ['CN=Microsoft MTA,CN=MAIL,CN= Servers,CN=
\xe9\xa0\x90\xe 8\xa8\xad\xe7\x b3\xbb\xe7\xb5\ xb1\xe7\xae
\xa1\xe7\x90\x8 6\xe7\xbe\xa4\x e7\xb5\x84,CN=A dministrative
Groups,CN=local host,CN=Microso ft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'instanceType': ['4'],
'lastLogoff': ['0'],
'lastLogon': ['12859896506671 8750'],
'legacyExchange DN': ['/o=localhost/ou=ExchangAdmin/cn=Recipients/
cn=joechiang'],
'logonCount': ['33'],
'mDBUseDefaults ': ['TRUE'],
'mail': ['joechiang@loca lhost.com'],
'mailNickname': ['joechiang'],
'memberOf': ['CN=AllHQStaff, CN=Users,DC=loc alhost,DC=com'],
'msExchALObject Version': ['60'],
'msExchHomeServ erName': ['/o=localhost/ou=ExchangAdmin/
cn=Configuratio n/cn=Servers/cn=MAIL'],
'msExchMailboxG uid': ['2\x04\x116^\xf c%J\x87yi\xbdj^ \x1bl'],
'msExchMailboxS ecurityDescript or': ['\x01\x00\x04\x 80x
\x00\x00\x00\x9 4\x00\x00\x00\x 00\x00\x00\x00\ x14\x00\x00\x00 \x04\x00d
\x00\x01\x00\x0 0\x00\x00\x02\x 14\x00\x03\x00\ x02\x00\x01\x01 \x00\x00\x00\x0 0\x00\x05\n
\x00\x00\x00a\x 00n\x00x\x00/\x00C\x00N\x00= \x00C\x00o\x00n \x00f\x00i
\x00g\x00u\x00r \x00a\x00t\x00i \x00o\x00n
\x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 0\x00\x00\x00\x 00\x00\x00\x00\ x00\x00\x00\x00 \x00\x00\x00\x0 1\x05\x00\x00\x 00\x00\x00\x05\ x15\x00\x00\x00 \xd6\xb2i
\x1a^\xa7P\xcb\ xday
\x88\xa9\xf4\x0 1\x00\x00\x01\x 05\x00\x00\x00\ x00\x00\x05\x15 \x00\x00\x00\xd 6\xb2i
\x1a^\xa7P\xcb\ xday\x88\xa9\xf 4\x01\x00\x00'],
'msExchPolicies Included': ['{C96E41C5-C5D5-411B-8672-1A3B6602437F},
{3B6813EC-CE89-42BA-9442-D87D4AA30DBC}',
'{C96E41C5-C5D5-411B-8672-1A3B6602437F},
{26491CFC-9E50-4857-861B-0CB8DF22B5D7}'],
'msExchUserAcco untControl': ['0'],
'name': ['\xe6\xb1\x9f\x e6\x9f\x8f\xe5\ xa3\x95'],
'objectCategory ':
['CN=Person,CN=S chema,CN=Config uration,DC=loca lhost,DC=com'],
'objectClass': ['top', 'person', 'organizational Person', 'user'],
'objectGUID': ['\x13\xfa\xc2\x bb\x9e\xee|C\x9 d\xa8_\xea]\xef
\xc6\x90'],
'objectSid':
['\x01\x05\x00\x 00\x00\x00\x00\ x05\x15\x00\x00 \x00\xd6\xb2i\x 1a^\xa7P
\xcb\xday\x88\x a9u\x0c\x00\x00 '],
'primaryGroupID ': ['513'],
'proxyAddresses ':
['X400:c=TW;a= ;p=localhost;o= Exchange;s=joec hiang;',
'SMTP:joechiang @localhost.com'],
'pwdLastSet': ['12858767039656 2500'],
'sAMAccountName ': ['joechiang'],
'sAMAccountType ': ['805306368'],
'showInAddressB ook': ['CN=\xe5\x85\xa 8\xe5\x9f\x9f\x e9\x80\x9a
\xe8\xa8\x8a\xe 6\xb8\x85\xe5\x 96\xae,CN=All Global Address
Lists,CN=Addres s Lists Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe7\x87\x9 f\xe9\x81\x8b\x e8\x99\x95,CN=A ll
Address Lists,CN=Addres s Lists Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe7\x94\x9 f\xe7\x89\xa9\x e7\xa7\x91\xe6\ x8a
\x80\xe8\x99\x9 5,CN=All Address Lists,CN=Addres s Lists
Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com',
'CN=\xe6\x89\x8 0\xe6\x9c\x89\x e4\xbd\xbf
\xe7\x94\xa8\xe 8\x80\x85,CN=Al l Address Lists,CN=Addres s Lists
Container,CN=lo calhost,CN=Micr osoft
Exchange,CN=Ser vices,CN=Config uration,DC=loca lhost,DC=com'],
'sn': ['\xe6\xb1\x9f'],
'textEncodedORA ddress':
['c=TW;a= ;p=localhost;o= Exchange;s=joec hiang;'],
'uSNChanged': ['22943844'],
'uSNCreated': ['21991450'],
'userAccountCon trol': ['66048'],
'userPrincipalN ame': ['joe@localhost. com'],
'whenChanged': ['20080624074423 .0Z'],
'whenCreated': ['20071205035154 .0Z']}
None
Comment