mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-03 04:52:54 +00:00
Added code to map illegal ncr values as per navigator
This commit is contained in:
parent
08f706df27
commit
54747eba59
@ -1024,6 +1024,51 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner&
|
||||
return result;
|
||||
}
|
||||
|
||||
#define PA_REMAP_128_TO_160_ILLEGAL_NCR 1
|
||||
|
||||
#ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR
|
||||
/**
|
||||
* Map some illegal but commonly used numeric entities into their
|
||||
* appropriate unicode value.
|
||||
*/
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
#endif /* PA_REMAP_128_TO_160_ILLEGAL_NCR */
|
||||
|
||||
|
||||
/*
|
||||
* This method converts this entity into its underlying
|
||||
@ -1038,8 +1083,15 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
||||
if(nsString::IsDigit(mTextValue[0])) {
|
||||
PRInt32 err=0;
|
||||
value=mTextValue.ToInteger(&err);
|
||||
if(0==err)
|
||||
if(0==err) {
|
||||
#ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR
|
||||
/* for some illegal, but popular usage */
|
||||
if ((value >= 0x0080) && (value <= 0x009f)) {
|
||||
value = PA_HackTable[value - 0x0080];
|
||||
}
|
||||
#endif
|
||||
aString.Append(PRUnichar(value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
char cbuf[30];
|
||||
|
@ -1024,6 +1024,51 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner&
|
||||
return result;
|
||||
}
|
||||
|
||||
#define PA_REMAP_128_TO_160_ILLEGAL_NCR 1
|
||||
|
||||
#ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR
|
||||
/**
|
||||
* Map some illegal but commonly used numeric entities into their
|
||||
* appropriate unicode value.
|
||||
*/
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
#endif /* PA_REMAP_128_TO_160_ILLEGAL_NCR */
|
||||
|
||||
|
||||
/*
|
||||
* This method converts this entity into its underlying
|
||||
@ -1038,8 +1083,15 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
||||
if(nsString::IsDigit(mTextValue[0])) {
|
||||
PRInt32 err=0;
|
||||
value=mTextValue.ToInteger(&err);
|
||||
if(0==err)
|
||||
if(0==err) {
|
||||
#ifdef PA_REMAP_128_TO_160_ILLEGAL_NCR
|
||||
/* for some illegal, but popular usage */
|
||||
if ((value >= 0x0080) && (value <= 0x009f)) {
|
||||
value = PA_HackTable[value - 0x0080];
|
||||
}
|
||||
#endif
|
||||
aString.Append(PRUnichar(value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
char cbuf[30];
|
||||
|
Loading…
x
Reference in New Issue
Block a user