diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 3ccbd0dec..e3dc326bf 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -705,8 +705,8 @@ void EditorPanel::info_toggled () { } infoString3 = Glib::ustring::compose ("%1%2", - Glib::path_get_dirname(openThm->getFileName()) + G_DIR_SEPARATOR_S, - Glib::path_get_basename(openThm->getFileName())); + escapeHtmlChars(Glib::path_get_dirname(openThm->getFileName())) + G_DIR_SEPARATOR_S, + escapeHtmlChars(Glib::path_get_basename(openThm->getFileName())) ); infoString = Glib::ustring::compose ("%1\n%2\n%3",infoString1, infoString2, infoString3); } diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 1b105267e..611398297 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -28,6 +28,37 @@ using namespace std; +Glib::ustring escapeHtmlChars(const Glib::ustring &src) { + + // Sources chars to be escaped + static const Glib::ustring srcChar("&<>"); + + // Destination strings, in the same order than the source + static std::vector dstChar(3); + dstChar.at(0) = "&"; + dstChar.at(1) = "<"; + dstChar.at(2) = ">"; + + // Copying the original string, that will be modified + Glib::ustring dst(src); + + // Iterating all chars of the copy of the source string + for (size_t i=0; i list = cont->get_children (); diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 392689c0c..1eed7274b 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -22,6 +22,7 @@ #include #include "../rtengine/rtengine.h" +Glib::ustring escapeHtmlChars(const Glib::ustring &src); bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference=true); void thumbInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh); Glib::ustring removeExtension (const Glib::ustring& filename);