escPath.ReplaceSubstring(";", "%3b");
net_GetURLSpecFromFile(nsIFile *aFile, nsACString &result){    nsresult rv;    nsCAutoString ePath;      // construct URL spec from native file path    rv = aFile->GetNativePath(ePath);    if (NS_FAILED(rv)) return rv;      // Replace \ with / to convert to an url    for (char *s = (char *) ePath.get(); *s; ++s) {        // We need to call IsDBCSLeadByte because        // Japanese windows can have 0x5C in the second byte         // of a Japanese character, for example 0x8F 0x5C is        // one Japanese character        if(::IsDBCSLeadByte(*s) && *(s+1))            ++s;        else if (*s == '\\')            *s = '/';    }    nsCAutoString escPath;    NS_NAMED_LITERAL_CSTRING(prefix, "file:///");      // Escape the path with the directory mask    if (NS_EscapeURL(ePath.get(), ePath.Length(), esc_Directory+esc_Forced, escPath))        escPath.Insert(prefix, 0);    else        escPath.Assign(prefix + ePath);    // XXX this should be unnecessary    if (escPath[escPath.Length() - 1] != '/') {        PRBool dir;        rv = aFile->IsDirectory(&dir);        if (NS_FAILED(rv))            NS_WARNING(PromiseFlatCString(                NS_LITERAL_CSTRING("Cannot tell if ") + escPath +                NS_LITERAL_CSTRING(" is a directory or file")).get());        else if (dir) {            // make sure we have a trailing slash            escPath += "/";        }    }        result = escPath;    return NS_OK;}