NS_ConvertUTF8toUCS2 ucs2Str(unescapedName);
nsresult ConvertAndSanitizeFileName(const char * displayName, PRUnichar ** unicodeResult, char ** result){  nsCAutoString unescapedName(displayName);  /* we need to convert the UTF-8 fileName to platform specific character set.     The display name is in UTF-8 because it has been escaped from JS  */   NS_UnescapeURL(unescapedName);  nsresult rv = NS_OK;#if defined(XP_MAC)  /* We need to truncate the name to 31 characters, this even on MacOS X until the file API     correctly support long file name. Using a nsILocalFile will do the trick...  */  nsCOMPtr<nsILocalFile> aLocalFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));  if (NS_SUCCEEDED(aLocalFile->SetLeafName(unescapedName)))  {    aLocalFile->GetLeafName(unescapedName);  }#endif  NS_ConvertUTF8toUCS2 ucs2Str(unescapedName);  // replace platform specific path separator and illegale characters to avoid any confusion  ucs2Str.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '-');  if (result)    rv = ConvertFromUnicode(nsMsgI18NFileSystemCharset(), ucs2Str, result);  if (unicodeResult)    *unicodeResult = ToNewUnicode(ucs2Str); return rv;}