summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rtfparser.cpp13
-rw-r--r--src/rtfparser.h4
-rw-r--r--src/rtfx.cpp1
-rw-r--r--src/xmlcomposer.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp
index 31e5971..7e70fe5 100644
--- a/src/rtfparser.cpp
+++ b/src/rtfparser.cpp
@@ -363,6 +363,10 @@ bool RtfParser::parseControlWord()
else if(ch >= '0' && ch <= '9')
param.append(1, (char)ch);
+ // Hyphens are part of the parameter of a control word
+ else if(ch == '-' && !controlword.empty())
+ param.append(1, (char)ch);
+
// Now handle escapes and other special types of
// control words. These are all only valid at beginning
// of the "control word"
@@ -475,16 +479,11 @@ bool RtfParser::parseControlWord()
else if(m_parseUnicode && flags & RtfHandler::kHasParam &&
controlword == "u" )
{
- sendData(numPar);
+ // RTF plays hokey and uses negative values in unicode
+ sendData((unsigned short)((short)numPar));
m_uniEat = m_uniEatStack.top();
}
- // Unicode destination
- else if(m_parseUnicode && controlword == "ud")
- {
-
- }
-
// Skip value for unicode characters
else if(m_parseUnicode && controlword == "uc")
{
diff --git a/src/rtfparser.h b/src/rtfparser.h
index fe2d415..9f0289e 100644
--- a/src/rtfparser.h
+++ b/src/rtfparser.h
@@ -71,7 +71,8 @@ public:
{ return m_depth; }
void setHexParse(bool parse)
{ m_parseHex = parse; }
- void setUnicode(bool unicode);
+ void setUnicode(bool unicode)
+ { m_parseUnicode = unicode; }
protected:
RtfHandler* m_handler; // The current handler
@@ -79,7 +80,6 @@ protected:
bool m_parseHex; // Whether to parse hex chars or not
string m_parseErrors; // A list of all the RTF parsing errors
- // TODO: Look at exactly what this is doing
// Unicode char handling
bool m_parseUnicode;
typedef std::stack<int> StackInt;
diff --git a/src/rtfx.cpp b/src/rtfx.cpp
index 5428148..7f35f7c 100644
--- a/src/rtfx.cpp
+++ b/src/rtfx.cpp
@@ -145,6 +145,7 @@ int main(int argc, char* argv[])
// Reads RTF tags and blocks
RtfParser rtf;
+ rtf.setUnicode(true);
// Interprets tags and blocks from RTFParser
XmlComposer composer(options);
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index f94ce29..93ae306 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -1129,7 +1129,7 @@ ON_CONTROLWORD(Root)
}
else if(cw == "field")
AN_ANALYSER(Field);
- else if(flags & kAsterisk)
+ else if(flags & kAsterisk && cw != "ud")
AN_ANALYSER(Skip);
else if(processTextContent(cw, flags, param))
DUMMY;