diff options
author | Stef Walter <stef@memberwebs.com> | 2006-10-16 14:42:04 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-10-16 14:42:04 +0000 |
commit | 8ef4da8da6cd9621f79d45a8ecaa59942102d252 (patch) | |
tree | a4a673654c5a71fcef902d50501e250b31aa9bdf | |
parent | b3eb4652ef1d96b9fbefb19f999cf535886c9058 (diff) |
- Don't let most characters below 0x0020 through. Old RTF's seem
to have these for strange reasons.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/rtfparser.cpp | 18 |
2 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Version 0.9.7 + + - Don't let most characters below 0x0020 through. Old RTF's seem + to have these for strange reasons. + Version 0.9.6 - Add character styles - Add <highlight> tag for highlighted text diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp index 7e70fe5..6ba9abe 100644 --- a/src/rtfparser.cpp +++ b/src/rtfparser.cpp @@ -45,11 +45,11 @@ const wchar_t kAnsiToUnicode[] = { - /* Invalid, but used for wierd things in RTF anyway :( */ - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, + /* Moltly invalid, but used for wierd things in RTF anyway :( */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0009, 0x000A, 0x0000, 0x0000, 0x000D, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* Low 7 bit, same */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, @@ -316,9 +316,15 @@ bool RtfParser::parseHexChar(int num, bool ansi) ASSERT((sizeof(kAnsiToUnicode) / sizeof(kAnsiToUnicode[0])) == 256); if(val < 0 || val >= 256) + { m_parseErrors.append("invalid ansi char: " + data + "\n"); + } else - sendData(kAnsiToUnicode[val]); + { + wchar_t ch = kAnsiToUnicode[val]; + if(ch) + sendData(ch); + } } else { |