@@ -111,9 +111,25 @@ public void DistinguishedName_SpacesAtBeginningAndEnd()
111111 [ TestMethod ]
112112 public void DistinguishedName_HexEscapeNonSpecialCharacter ( )
113113 {
114- throw new AssertInconclusiveException ( "Support for this type of DN has not yet been implemented." ) ;
114+ // \20 is the hex escape for a space character.
115115 var dn = new DistinguishedName ( @"CN=John\20Doe,OU=Employees,DC=adatum,DC=com" ) ;
116- Assert . AreEqual ( dn . ToString ( ) , @"CN=John Doe,OU=Employees,DC=adatum,DC=com" ) ;
116+ Assert . AreEqual ( "John Doe" , dn . Components [ 0 ] . Value ) ;
117+ Assert . AreEqual ( @"CN=John Doe,OU=Employees,DC=adatum,DC=com" , dn . ToString ( ) ) ;
118+
119+ // \C3\B6 is the RFC 4514 byte-by-byte UTF-8 encoding of 'ö'. The parser must accept
120+ // hex-escaped input (some tools produce it), but the writer must emit the literal
121+ // Unicode character — DRSR IDL_DRSCrackNames rejects the hex-escaped form for
122+ // DS_FQDN_1779_NAME, which broke Get-ADReplAccount on domains with German umlauts
123+ // in site names (issue #224).
124+ var dn2 = new DistinguishedName ( @"CN=142SRV-DC,CN=Servers,CN=L\C3\B6hne,CN=Sites,CN=Configuration,DC=adatum,DC=local" ) ;
125+ Assert . AreEqual ( "Löhne" , dn2 . Components [ 2 ] . Value ) ;
126+ Assert . AreEqual ( "CN=142SRV-DC,CN=Servers,CN=Löhne,CN=Sites,CN=Configuration,DC=adatum,DC=local" , dn2 . ToString ( ) ) ;
127+
128+ // Round-trip a DN that already uses literal Unicode — non-ASCII chars must be
129+ // preserved verbatim, not converted to hex byte escapes.
130+ var dn3 = new DistinguishedName ( "CN=Löhne,CN=Sites,CN=Configuration,DC=adatum,DC=local" ) ;
131+ Assert . AreEqual ( "Löhne" , dn3 . Components [ 0 ] . Value ) ;
132+ Assert . AreEqual ( "CN=Löhne,CN=Sites,CN=Configuration,DC=adatum,DC=local" , dn3 . ToString ( ) ) ;
117133 }
118134
119135 [ TestMethod ]
0 commit comments