Wallet_Encrypt (const nsString& textUCS2, nsString& cryptUCS2) { nsCAutoString cryptUTF8; nsresult rv = wallet_Encrypt(NS_ConvertUCS2toUTF8(textUCS2), cryptUTF8); cryptUCS2 = NS_ConvertUTF8toUCS2(cryptUTF8); return rv;
Wallet_Encrypt (const nsString& text, nsString& crypt) {   nsAutoString UTF8text; PRUnichar c; for (PRUint32 i=0; i<text.Length(); i++) { c = text.CharAt(i); if (c <= 0x7F) { UTF8text.Append(c); } else if (c <= 0x7FF) { UTF8text += PRUnichar((0xC0) | ((c>>6) & 0x1F)); UTF8text += PRUnichar((0x80) | (c & 0x3F)); } else { UTF8text += PRUnichar((0xE0) | ((c>>12) & 0xF)); UTF8text += PRUnichar((0x80) | ((c>>6) & 0x3F)); UTF8text += PRUnichar((0x80) | (c & 0x3F)); } }   char * cryptCString = nsnull; char * UTF8textCString = ToNewCString(UTF8text); nsresult rv = EncryptString(UTF8textCString, cryptCString); Recycle (UTF8textCString); if NS_FAILED(rv) { return rv; } crypt.AssignWithConversion(cryptCString); Recycle (cryptCString); return NS_OK;
Wallet_Encrypt (const nsString& textUCS2, nsString& cryptUCS2) {  nsCAutoString cryptUTF8;  nsresult rv = wallet_Encrypt(NS_ConvertUCS2toUTF8(textUCS2), cryptUTF8);  cryptUCS2 = NS_ConvertUTF8toUCS2(cryptUTF8);  return rv;}