Added RTF escapes parsing
This commit is contained in:
parent
01dcf3d6c8
commit
8e3e4a5445
|
@ -939,11 +939,11 @@ const unsigned short ansicpg874[256] = {
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
const char *cw;
|
const char *cw;
|
||||||
NSString *s;
|
NSString *s;
|
||||||
|
char nextByte = *(_bytes+1);
|
||||||
|
|
||||||
if (*(_bytes+1) == '\'')
|
if (nextByte == '\'')
|
||||||
{
|
{
|
||||||
// A hexadecimal value, based on the specified character set (may be used to identify 8-bit values).
|
// A hexadecimal value, based on the specified character set (may be used to identify 8-bit values).
|
||||||
NSString *s;
|
|
||||||
NSData *d;
|
NSData *d;
|
||||||
|
|
||||||
const char *b1, *b2;
|
const char *b1, *b2;
|
||||||
|
@ -971,11 +971,31 @@ const unsigned short ansicpg874[256] = {
|
||||||
[_html appendData: d];
|
[_html appendData: d];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (*(_bytes+1) == '*')
|
else if (nextByte == '*')
|
||||||
{
|
{
|
||||||
[self parseIgnoringEverything];
|
[self parseIgnoringEverything];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (!isalpha(nextByte))
|
||||||
|
{
|
||||||
|
// escape + character
|
||||||
|
ADVANCE_N(2);
|
||||||
|
// check for special escapes for the no-implemented features
|
||||||
|
// for control of word breaking
|
||||||
|
if (nextByte == '~')
|
||||||
|
// no breaking space
|
||||||
|
nextByte = ' ';
|
||||||
|
else if (nextByte == '-')
|
||||||
|
// optional hyphen; we skip it
|
||||||
|
continue;
|
||||||
|
else if (nextByte == '_')
|
||||||
|
// no breaking hyphen, treat it as a normal hyphen
|
||||||
|
nextByte = '-';
|
||||||
|
|
||||||
|
[_html appendBytes: &nextByte length: 1];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cw = [self parseControlWord: &len];
|
cw = [self parseControlWord: &len];
|
||||||
|
|
||||||
|
@ -1248,7 +1268,6 @@ const unsigned short ansicpg874[256] = {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* XXXX TODO add special stick together chars? */
|
|
||||||
// We avoid appending NULL bytes or endlines
|
// We avoid appending NULL bytes or endlines
|
||||||
if (*_bytes && (*_bytes != '\n'))
|
if (*_bytes && (*_bytes != '\n'))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue