outBuf[dstLength] = '\0';
extern "C" PRBool nlsUnicodeToUTF8(unsigned char * inBuf, unsigned int inBufBytes,							unsigned char * outBuf, unsigned int maxOutBufLen,							unsigned int * outBufLen){	PRBool ret = PR_FALSE;	nsIUnicodeEncoder *enc = encoderUTF8;	PRInt32 dstLength;	nsresult res;	res = enc->GetMaxLength((const PRUnichar *)inBuf, inBufBytes, &dstLength);	if (NS_FAILED(res) || (dstLength > maxOutBufLen)) {		goto loser;	}	res = enc->Convert((const PRUnichar *)inBuf, (PRInt32*)&inBufBytes, (char*)outBuf, &dstLength);	if (NS_FAILED(res)) {		goto loser;	}	/* outBuf[dstLength] = '\0';*/	*outBufLen = dstLength;	ret = PR_TRUE;loser:	return ret;}