Bug 691690 - Part 1: Add UTF-8 flag to createFixupURI. r=bz

This commit is contained in:
Masatoshi Kimura 2011-10-19 16:39:07 +09:00
parent 34621450c8
commit d6147c4165
2 changed files with 7 additions and 1 deletions

View File

@ -236,6 +236,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, PRUint32 aFixupF
bool bAsciiURI = IsASCII(uriString);
bool bUseNonDefaultCharsetForURI =
!bAsciiURI &&
!(aFixupFlags & FIXUP_FLAG_USE_UTF8) &&
(scheme.IsEmpty() ||
scheme.LowerCaseEqualsLiteral("http") ||
scheme.LowerCaseEqualsLiteral("https") ||
@ -322,7 +323,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, PRUint32 aFixupF
uriString.Assign(NS_LITERAL_CSTRING("http://") + uriString);
// For ftp & http, we want to use system charset.
if (!bAsciiURI)
if (!bAsciiURI && !(aFixupFlags & FIXUP_FLAG_USE_UTF8))
bUseNonDefaultCharsetForURI = true;
} // end if checkprotocol

View File

@ -63,6 +63,11 @@ interface nsIURIFixup : nsISupports
*/
const unsigned long FIXUP_FLAGS_MAKE_ALTERNATE_URI = 2;
/**
* Use UTF-8 to encode the URI instead of platform charset.
*/
const unsigned long FIXUP_FLAG_USE_UTF8 = 4;
/**
* Converts an internal URI (e.g. a wyciwyg URI) into one which we can
* expose to the user, for example on the URL bar.