summaryrefslogtreecommitdiffstats
path: root/src/docbookgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/docbookgen.cpp')
-rw-r--r--src/docbookgen.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index db11c67..3615ad5 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -101,9 +101,21 @@ inline void writeDocbookCodeString(FTextStream &t,const char *s, int &col)
case '&': t << "&amp;"; col++; break;
case '\'': t << "&apos;"; col++; break;
case '"': t << "&quot;"; col++; break;
- case '\007': t << "^G"; col++; break; // bell
- case '\014': t << "^L"; col++; break; // form feed
- default: t << c; col++; break;
+ default:
+ {
+ uchar uc = static_cast<uchar>(c);
+ static const char *hex="0123456789ABCDEF";
+ if (uc<32)
+ {
+ t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";";
+ }
+ else
+ {
+ t << c;
+ }
+ col++;
+ }
+ break;
}
}
}