char * UTF8textCString = UTF8text.ToNewCString();
char * UTF8textCString = ToNewCString(UTF8text);
Wallet_Encrypt (const nsString& text, nsString& crypt) {  /* convert text from unichar to UTF8 */  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));    }  }    /* encrypt text to crypt */  char * cryptCString = nsnull;  char * UTF8textCString = UTF8text.ToNewCString();  nsresult rv = EncryptString(UTF8textCString, cryptCString);  Recycle (UTF8textCString);  if NS_FAILED(rv) {    return rv;  }  crypt.AssignWithConversion(cryptCString);  Recycle (cryptCString);  return NS_OK;}