Fixed an exception in the new dialog.

AI0867 and soliton discovered that the new dialogs sometimes failed with
an exception. The pango markup requires some characters to be escaped so
added the code to do that.
This commit is contained in:
Mark de Wever 2009-02-03 20:22:00 +00:00
parent 2e17f9dbbb
commit d8424f2b1a
2 changed files with 25 additions and 1 deletions

View File

@ -2,6 +2,8 @@ Version 1.5.9+svn:
* Language and i18n:
* new translations: Marathi
* updated translations: British English, Dutch, German, Slovenian
* User interface:
* Fixed an exception when a certain characters weren't escaped
* Miscellaneous and bug fixes:
* Fix flickering of units in the second part of the tutorial (bug #12923)

View File

@ -407,6 +407,28 @@ std::string colour_prefix(const SDL_Color& colour)
return result.str();
}
/** escapes a string to be used in a pango formatted string. */
std::string escape_string(const std::string& str)
{
struct tconverter
{
tconverter(const std::string& string)
: str(g_markup_escape_text(string.c_str(), -1))
{
}
~tconverter()
{
g_free(str);
}
gchar* str;
};
tconverter converter(str);
return std::string(converter.str);
}
} // namespace
std::string tcontrol::get_pango_markup() const
@ -505,7 +527,7 @@ std::string tcontrol::get_pango_markup() const
}
}
line = pre + line + post;
line = pre + escape_string(line) + post;
}
return utils::join(lines, '\n');
}