nsresult rv = NS_OK;
char* UnicodeToNewBytes(const PRUnichar* aSrc, PRUint32 aLen, nsIUnicodeEncoder* encoder){   char* res = nsnull;   if(NS_SUCCEEDED(encoder->Reset()))   {      nsresult rv = NS_OK;      PRInt32 maxByteLen = 0;      if(NS_SUCCEEDED(encoder->GetMaxLength(aSrc, (PRInt32) aLen, &maxByteLen)))       {          res = new char[maxByteLen+1];          if(nsnull != res)           {             PRInt32 reslen = maxByteLen;             PRInt32 reslen2 ;             PRInt32 srclen = aLen;             encoder->Convert(aSrc, &srclen, res, &reslen);             reslen2 = maxByteLen-reslen;             encoder->Finish(res+reslen, &reslen2);             res[reslen+reslen2] = '\0';          }      }   }   return res;}