From 0f8902275a4c02196d4eb1398e621a349355410a Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 23 Jul 2018 18:47:56 +0200 Subject: Improvements in handling special characters in Latex - In case a corrupted character is found LaTeX shows this as a U+FFFD , the character in the code is 0xef 0xbf oxbd. This character was in the LaTex Code already replaced with `\ucr` but this didn't work properly with TexLive 2015 and the code is now detected i the doxygen code and directly replaced `\ucr` - other special characters are now handled, in a way that works in all engines, by means of `\newunicodechar` - the size of the `\ucr` was not set in case it was used in 'running text' and not inside e.g. a code section. --- src/util.cpp | 37 ++++++++++++++++++++++++------------- templates/latex/doxygen.sty | 13 ++++--------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index a0522d4..6c7e3d5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6741,6 +6741,16 @@ void filterLatexString(FTextStream &t,const char *str, { switch(c) { + case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd + // the LaTeX command \ucr has been defined in doxygen.sty + if ((unsigned char)*(p) == 0xbf && (unsigned char)*(p+1) == 0xbd) + { + t << "{\\ucr}"; + p += 2; + } + else + t << (char)c; + break; case '\\': t << "\\(\\backslash\\)"; break; case '{': t << "\\{"; break; case '}': t << "\\}"; break; @@ -6762,6 +6772,16 @@ void filterLatexString(FTextStream &t,const char *str, { switch(c) { + case 0xef: // handle U+FFFD i.e. "Replacement character" caused by octal: 357 277 275 / hexadecimal 0xef 0xbf 0xbd + // the LaTeX command \ucr has been defined in doxygen.sty + if ((unsigned char)*(p) == 0xbf && (unsigned char)*(p+1) == 0xbd) + { + t << "{\\ucr}"; + p += 2; + } + else + t << (char)c; + break; case '#': t << "\\#"; break; case '$': t << "\\$"; break; case '%': t << "\\%"; break; @@ -8865,19 +8885,10 @@ void writeLatexSpecialFormulaChars(FTextStream &t) sup3[1]= 0xB3; sup3[2]= 0; - t << "\\ifthenelse{\\isundefined{\\DeclareUnicodeCharacter}}{%\n" - " \\catcode`\\" << pminus << "=13% Superscript minus\n" - " \\def" << pminus << "{${}^{-}$}\n" - " \\catcode`\\" << psup2 << "=13% Superscript two\n" - " \\def" << psup2 << "{${}^{2}$}\n" - " \\catcode`\\"<