.net 4.7.2,用以下代码连接 LDAP 服务器,并发送查询请求:
using ldap as new DirectoryServices.Protocols.LdapConnection(...)
ldap.SendRequest(New DirectoryServices.Protocols.SearchRequest("baseDN", "(givenName=中)", ...))
...
end using
查询字符串中的汉字被用本机代码页编码(936/GB2312 时为 D6 D0、932/Shift-JIS 时为 92 86),而 LDAP 服务器上的数据遵从 RFC4514、是 UTF-8 编码的
E4 B8 AD。
问题:是否应统一使用 UTF-8 发送请求?这是否是 .net 的实现 bug?