summaryrefslogtreecommitdiffstats
path: root/src/rtfgen.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2011-08-14 13:56:38 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2011-08-14 13:56:38 (GMT)
commit9be758009e1a4c616377dc33ccf1e55dd8b04d9b (patch)
tree3138a0d18d53a00498b4cad59f934a4e64762cf8 /src/rtfgen.cpp
parent64f0c97c3adaa28edf6f1da3264621a18c1d1adb (diff)
downloadDoxygen-9be758009e1a4c616377dc33ccf1e55dd8b04d9b.zip
Doxygen-9be758009e1a4c616377dc33ccf1e55dd8b04d9b.tar.gz
Doxygen-9be758009e1a4c616377dc33ccf1e55dd8b04d9b.tar.bz2
Release-1.7.5
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r--src/rtfgen.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index 1b4a18c..578cda5 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -2243,6 +2243,37 @@ void RTFGenerator::endMemberSubtitle()
//}
//
+bool isLeadBytes(int c)
+{
+ bool result;
+
+ QCString codePage = theTranslator->trRTFansicp();
+
+ if (codePage == "932") // cp932 (Japanese Shift-JIS)
+ {
+ result = (0x81<=c && c<=0x9f) || (0xe0<=c && c<=0xfc);
+ }
+ else if (codePage == "936") // cp936 (Simplified Chinese GBK)
+ {
+ result = 0x81<=c && c<=0xFE;
+ }
+ else if (codePage == "949") // cp949 (Korean)
+ {
+ result = 0x81<=c && c<=0xFE;
+ }
+ else if (codePage == "950") // cp950 (Traditional Chinese Big5)
+ {
+ result = 0x81<=c && c<=0xFE;
+ }
+ else // for SBCS Codepages (cp1252,1251 etc...)
+ {
+ result = false;
+ }
+
+ return result;
+}
+
+
// note: function is not reentrant!
static void encodeForOutput(FTextStream &t,const QCString &s)
{
@@ -2276,14 +2307,26 @@ static void encodeForOutput(FTextStream &t,const QCString &s)
enc.resize(l);
}
uint i;
+ bool multiByte = FALSE;
+
for (i=0;i<enc.size();i++)
{
uchar c = (uchar)enc.at(i);
- if (c>=0x80)
+
+ if (c>=0x80 || multiByte)
{
char esc[10];
- sprintf(esc,"\\'%X",c);
+ sprintf(esc,"\\'%X",c); // escape sequence for SBCS and DBCS(1st&2nd bytes).
t << esc;
+
+ if (!multiByte)
+ {
+ multiByte = isLeadBytes(c); // It may be DBCS Codepages.
+ }
+ else
+ {
+ multiByte = FALSE; // end of Double Bytes Character.
+ }
}
else
{