Hello
My ldif file type is UTF-8 as below.
# file test.ldif
test.ldif: UTF-8 Unicode text
The test.ldif content includes Chinese, as below:
# cat test.ldif
dn: cn=行政部,ou=domain,dc=domain,dc=com
cn: 行政部
gidnumber: 500
objectclass: posixGroup
I can add it to the LDAP server. Then excuting this command “# ldapsearch -x -H ldap://localhost -b dc=domain,dc=com” , it display as below:
# \E7\94\B0\E5\BF\97\E8\8B\B1, domain, domain.com
dn:: Y24955Sw5b+X6IuxLG91PXRodW5kZXJzb2Z0LGRjPXRodW5kZXJzb2Z0LGRjPWNvbQ==
cn:: 55Sw5b+X6Iux
gidNumber: 500
objectClass: posixGroup
objectClass: top
How can I deal with it? Can you help me?
Thanks!!!
On 05/02/2015 11:17, Tian Zhiying wrote:
dn: cn=行政部,ou=domain,dc=domain,dc=com
cn: 行政部
gidnumber: 500
objectclass: posixGroup
I can add it to the LDAP server. Then excuting this command “# ldapsearch -x -H ldap://localhost -b dc=domain,dc=com” , it display as below:
dn:: Y24955Sw5b+X6IuxLG91PXRodW5kZXJzb2Z0LGRjPXRodW5kZXJzb2Z0LGRjPWNvbQ==
cn:: 55Sw5b+X6Iux
It's just base64 encoded. When I decode that it looks fine (though not what you quoted as the original data:
dn: cn=田志英,ou=thundersoft,dc=thundersoft,dc=com cn: 田志英
The :: notation against the attribute in the output is a hint that the value is base64 encoded.
Am Thu, 5 Feb 2015 19:17:25 +0800 schrieb "Tian Zhiying" tianzy1225@thundersoft.com:
Hello
My ldif file type is UTF-8 as below.
# file test.ldif
test.ldif: UTF-8 Unicode text
The test.ldif content includes Chinese, as below:
# cat test.ldif
dn: cn=行政部,ou=domain,dc=domain,dc=com
cn: 行政部
gidnumber: 500
objectclass: posixGroup
I can add it to the LDAP server. Then excuting this command “# ldapsearch -x -H ldap://localhost -b dc=domain,dc=com” , it display as below:
# \E7\94\B0\E5\BF\97\E8\8B\B1, domain, domain.com
dn:: Y24955Sw5b+X6IuxLG91PXRodW5kZXJzb2Z0LGRjPXRodW5kZXJzb2Z0LGRjPWNvbQ==
cn:: 55Sw5b+X6Iux
gidNumber: 500
objectClass: posixGroup
objectClass: top
This is just the base64 encoded DN string, decoded it is
cn=田志英,ou=thundersoft,dc=thundersoft,dc=com
-Dieter
Hi ,
Thank you very much.
How can I display chinese in LDAP database, rather than a base64 code?
-----邮件原件----- 发件人: openldap-technical [mailto:openldap-technical-bounces@openldap.org] 代表 Dieter Klünter 发送时间: 2015年2月5日 19:57 收件人: openldap-technical@openldap.org 主题: Re: Chinese display garbled
Am Thu, 5 Feb 2015 19:17:25 +0800 schrieb "Tian Zhiying" tianzy1225@thundersoft.com:
Hello
My ldif file type is UTF-8 as below.
# file test.ldif
test.ldif: UTF-8 Unicode text
The test.ldif content includes Chinese, as below:
# cat test.ldif
dn: cn=行政部,ou=domain,dc=domain,dc=com
cn: 行政部
gidnumber: 500
objectclass: posixGroup
I can add it to the LDAP server. Then excuting this command “# ldapsearch -x -H ldap://localhost -b dc=domain,dc=com” , it display as below:
# \E7\94\B0\E5\BF\97\E8\8B\B1, domain, domain.com
dn:: Y24955Sw5b+X6IuxLG91PXRodW5kZXJzb2Z0LGRjPXRodW5kZXJzb2Z0LGRjPWNvbQ==
cn:: 55Sw5b+X6Iux
gidNumber: 500
objectClass: posixGroup
objectClass: top
This is just the base64 encoded DN string, decoded it is
cn=田志英,ou=thundersoft,dc=thundersoft,dc=com
-Dieter
-- Dieter Klünter | Systemberatung http://sys4.de GPG Key ID: E9ED159B 53°37'09,95"N 10°08'02,42"E
AFAIK, the data is NOT stored as Base64, and LDAP operations also don't provide BASE64. Only LDIF as an Interchange format uses US-ASCII for representation. If you use some proper LDAP GUI, you can enter (and display) UTF-8 correctly.
Regards, Ulrich
"Tian Zhiying" tianzy1225@thundersoft.com schrieb am 06.02.2015 um 03:22
in Nachricht 003501d041b3$cab6e680$6024b380$@thundersoft.com:
Hi ,
Thank you very much.
How can I display chinese in LDAP database, rather than a base64 code?
-----邮件原件----- 发件人: openldap-technical [mailto:openldap-technical-bounces@openldap.org] 代表
Dieter Klünter 发送时间: 2015年2月5日 19:57 收件人: openldap-technical@openldap.org 主题: Re: Chinese display garbled
Am Thu, 5 Feb 2015 19:17:25 +0800 schrieb "Tian Zhiying" tianzy1225@thundersoft.com:
Hello
My ldif file type is UTF-8 as below.
# file test.ldif
test.ldif: UTF-8 Unicode text
The test.ldif content includes Chinese, as below:
# cat test.ldif
dn: cn=行政部,ou=domain,dc=domain,dc=com
cn: 行政部
gidnumber: 500
objectclass: posixGroup
I can add it to the LDAP server. Then excuting this command “# ldapsearch -x -H ldap://localhost -b dc=domain,dc=com” , it display as below:
# \E7\94\B0\E5\BF\97\E8\8B\B1, domain, domain.com
dn:: Y24955Sw5b+X6IuxLG91PXRodW5kZXJzb2Z0LGRjPXRodW5kZXJzb2Z0LGRjPWNvbQ==
cn:: 55Sw5b+X6Iux
gidNumber: 500
objectClass: posixGroup
objectClass: top
This is just the base64 encoded DN string, decoded it is
cn=田志英,ou=thundersoft,dc=thundersoft,dc=com
-Dieter
-- Dieter Klünter | Systemberatung http://sys4.de GPG Key ID: E9ED159B 53°37'09,95"N 10°08'02,42"E
Tian Zhiying wrote:
How can I display chinese in LDAP database, rather than a base64 code?
Actually the attribute values with LDAP syntax DirectoryString are stored as UTF-8 encoded Unicode. When a client retrieves those via LDAP it will receive the UTF-8 encoding.
But LDIF mandates that every non-ASCII attribute value is formatted with double-colon base64 [1].
Ciao, Michael.
openldap-technical@openldap.org