*aReturn = tmp.ToNewUnicode();
*aReturn = ToNewUnicode(tmp);
nsTypedSelection::ToStringWithFormat(const char * aFormatType, PRUint32 aFlags,                                    PRInt32 aWrapCol, PRUnichar **aReturn){  nsresult rv = NS_OK;  if (!aReturn)    return NS_ERROR_NULL_POINTER;    nsCOMPtr<nsIDocumentEncoder> encoder;  nsCAutoString formatType( NS_DOC_ENCODER_CONTRACTID_BASE );  formatType.Append(aFormatType);  rv = nsComponentManager::CreateInstance(formatType,                                          nsnull,                                          NS_GET_IID(nsIDocumentEncoder),                                          getter_AddRefs(encoder));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIPresShell> shell;  rv = GetPresShell(getter_AddRefs(shell));  if (NS_FAILED(rv) || !shell) {    return NS_ERROR_FAILURE;  }  nsCOMPtr<nsIDocument> doc;  rv = shell->GetDocument(getter_AddRefs(doc));  NS_ENSURE_SUCCESS(rv, rv);  // Flags should always include OutputSelectionOnly if we're coming from here:  aFlags |= nsIDocumentEncoder::OutputSelectionOnly;  nsAutoString readstring;  readstring.AssignWithConversion(aFormatType);  rv = encoder->Init(doc, readstring, aFlags);  NS_ENSURE_SUCCESS(rv, rv);  encoder->SetSelection(this);  if (aWrapCol != 0)    encoder->SetWrapColumn(aWrapCol);  nsAutoString tmp;  rv = encoder->EncodeToString(tmp);  *aReturn = tmp.ToNewUnicode();//get the unicode pointer from it. this is temporary  return rv;}