Use ASCII-compatible fallback if an encoder has no values defined for code points below U+0020. Bug 399257, r=jshin

This commit is contained in:
Simon Montagu
2008-06-04 22:53:33 +03:00
parent 8c26deee39
commit ea779da983
2 changed files with 60 additions and 2 deletions

View File

@@ -62,8 +62,13 @@ nsresult nsUnicodeEncodeHelper::ConvertByTable(
while (src < srcEnd) {
if (!uMapCode((uTable*) aMappingTable, static_cast<PRUnichar>(*(src++)), reinterpret_cast<PRUint16*>(&med))) {
res = NS_ERROR_UENC_NOMAPPING;
break;
if (*(src - 1) < 0x20) {
// some tables are missing the 0x00 - 0x20 part
med = *(src - 1);
} else {
res = NS_ERROR_UENC_NOMAPPING;
break;
}
}
PRBool charFound;