diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | src/menuconfiguration.cpp | 15 | ||||
-rw-r--r-- | src/menuconfiguration.h | 3 | ||||
-rw-r--r-- | src/version.h | 2 |
5 files changed, 22 insertions, 4 deletions
@@ -10,3 +10,7 @@ VDR Plugin 'menuorg' Revision History - Fixed bug with burn plug-in - cPlugin::MainMenuEntry() should not be called before all plug-ins Intialize() and Start() were called. +2007-08-25: Version 0.3 + +- Fixed charset conversion for menu titles. They will now explicitly be converted + to VDR's locale charset falling back to ISO8859-2 on conversion errors. @@ -25,7 +25,7 @@ Requirements: ------------- The plug-in has been tested with vdr 1.4.7 and 1.5.7. It requires the libxml++2.6 -library. +and libglibmm-2.4 library. Configuration: diff --git a/src/menuconfiguration.cpp b/src/menuconfiguration.cpp index f096ba2..b9c01b4 100644 --- a/src/menuconfiguration.cpp +++ b/src/menuconfiguration.cpp @@ -25,6 +25,7 @@ #include <exception> #include <iostream> #include <vdr/plugin.h> +#include <glibmm/convert.h> #include "systemmenunode.h" #include "submenunode.h" #include "pluginmenunode.h" @@ -94,7 +95,7 @@ void MenuConfiguration::ParseElement(const Element* element, MenuNode* menuNode) const xmlpp::Attribute* nameAttribute = childElement->get_attribute("name"); string type = childElement->get_name(); - string name = nameAttribute->get_value(); + string name = UnicodeToLocaleOrIso8859(nameAttribute->get_value()); if ( type == "menu") { @@ -208,3 +209,15 @@ void MenuConfiguration::AddCommandMenuNode(string name, string command, bool con { menu->AddChild(new CommandMenuNode(name, command, confirm)); } + +string MenuConfiguration::UnicodeToLocaleOrIso8859(Glib::ustring unicodeString) +{ + try + { + return Glib::locale_from_utf8(unicodeString); + } + catch (Glib::ConvertError) + { + return Glib::convert_with_fallback(unicodeString, "ISO8859-2", "UTF-8"); + } +} diff --git a/src/menuconfiguration.h b/src/menuconfiguration.h index 292567e..5979150 100644 --- a/src/menuconfiguration.h +++ b/src/menuconfiguration.h @@ -26,9 +26,9 @@ #include <string> #include <vector> #include <vdr/osdbase.h> +#include <glibmm/ustring.h> namespace xmlpp { class Element; } - class MenuNode; class cPlugin; @@ -50,6 +50,7 @@ class MenuConfiguration void AddPluginMenuNode(std::string pluginName, MenuNode* menu); void AddUnconfiguredPlugins(MenuNode* menu); void AddCommandMenuNode(std::string name, std::string command, bool confirm, MenuNode* menu); + std::string UnicodeToLocaleOrIso8859(Glib::ustring unicodeString); }; #endif diff --git a/src/version.h b/src/version.h index 105c644..8b208f0 100644 --- a/src/version.h +++ b/src/version.h @@ -23,6 +23,6 @@ #ifndef ___VERSION_H #define ___VERSION_H -static const char VERSION[] = "0.2"; +static const char VERSION[] = "0.3"; #endif |