Bug 309335 Unknown content type dialog(helper app dialog) shows escaped file name if it has non-ASCII char r+sr=darin
git-svn-id: svn://10.0.0.236/trunk@181388 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIIDNService.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "prlog.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@@ -2454,7 +2455,14 @@ nsStandardURL::SetFile(nsIFile *file)
|
||||
rv = net_GetURLSpecFromFile(file, url);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = SetSpec(url);
|
||||
// We should always set the charset until bug 278161 is fixed.
|
||||
nsCOMPtr <nsIPlatformCharset> platformCharset =
|
||||
do_GetService(NS_PLATFORMCHARSET_CONTRACTID);
|
||||
nsCAutoString charset;
|
||||
if (platformCharset)
|
||||
platformCharset->GetCharset(kPlatformCharsetSel_FileName, charset);
|
||||
|
||||
rv = Init(mURLType, mDefaultPort, url, charset.get(), nsnull);
|
||||
|
||||
// must clone |file| since its value is not guaranteed to remain constant
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
@@ -269,8 +270,15 @@ nsFileProtocolHandler::NewURI(const nsACString &spec,
|
||||
specPtr = &buf;
|
||||
#endif
|
||||
|
||||
// XXX perhaps we should convert |charset| to whatever the system charset
|
||||
// is so that nsStandardURL will normalize our URL string properly?
|
||||
nsCAutoString urlCharset;
|
||||
// We should set file system charset until bug 278161 is fixed.
|
||||
nsCOMPtr <nsIPlatformCharset> platformCharset =
|
||||
do_GetService(NS_PLATFORMCHARSET_CONTRACTID);
|
||||
if (platformCharset) {
|
||||
platformCharset->GetCharset(kPlatformCharsetSel_FileName, urlCharset);
|
||||
if (!urlCharset.IsEmpty())
|
||||
charset = urlCharset.get();
|
||||
}
|
||||
|
||||
nsresult rv = url->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
|
||||
*specPtr, charset, baseURI);
|
||||
@@ -333,8 +341,8 @@ nsFileProtocolHandler::NewFileURI(nsIFile *file, nsIURI **result)
|
||||
if (!url)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// XXX shouldn't we set nsIURI::originCharset ??
|
||||
|
||||
// NOTE: the origin charset is assigned the value of the platform
|
||||
// charset by the SetFile method.
|
||||
rv = url->SetFile(file);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user