Changed to control entity (CER) generation by a document charset, bug 65324, r=jst, sr=vidur.
git-svn-id: svn://10.0.0.236/trunk@86864 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -83,7 +83,8 @@ nsHTMLContentSerializer::GetParserService(nsIParserService** aParserService)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn)
|
||||
nsHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
|
||||
nsIAtom* aCharSet)
|
||||
{
|
||||
mFlags = aFlags;
|
||||
if (!aWrapColumn) {
|
||||
@@ -114,6 +115,16 @@ nsHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn)
|
||||
|
||||
mPreLevel = 0;
|
||||
|
||||
mIsLatin1 = PR_FALSE;
|
||||
if (aCharSet) {
|
||||
const PRUnichar *charset;
|
||||
aCharSet->GetUnicode(&charset);
|
||||
|
||||
if (NS_LITERAL_STRING("ISO-8859-1").Equals(charset)) {
|
||||
mIsLatin1 = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -526,7 +537,7 @@ nsHTMLContentSerializer::AppendToString(const nsAReadableString& aStr,
|
||||
if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
|
||||
entityText = entityTable[val];
|
||||
break;
|
||||
} else if (val > 127) {
|
||||
} else if (mIsLatin1 && val > 127 && val < 256) {
|
||||
parserService->HTMLConvertUnicodeToEntity(val, entityReplacement);
|
||||
|
||||
if (entityReplacement.Length() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user