diff --git a/directory/xpcom/base/src/nsLDAPMessage.cpp b/directory/xpcom/base/src/nsLDAPMessage.cpp index e6f908d4a6cd..dfbe6cf5277c 100644 --- a/directory/xpcom/base/src/nsLDAPMessage.cpp +++ b/directory/xpcom/base/src/nsLDAPMessage.cpp @@ -518,7 +518,11 @@ nsLDAPMessage::GetValues(const char *aAttr, PRUint32 *aCount, // PRUint32 i; for ( i = 0 ; i < numVals ; i++ ) { - (*aValues)[i] = UTF8ToNewUnicode(nsDependentCString(values[i])); + nsDependentCString sValue(values[i]); + if (IsUTF8(sValue)) + (*aValues)[i] = UTF8ToNewUnicode(sValue); + else + (*aValues)[i] = ToNewUnicode(sValue); if ( ! (*aValues)[i] ) { NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, aValues); ldap_value_free(values);