summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-25 19:46:15 +0000
committersvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-25 19:46:15 +0000
commitf3bbcd9476beec7c43d2adb3bc0129ff8041d7ad (patch)
treedcb2502352c3d8c33b9910c0f3d2e671520e37d5
parentbf2e1469fb12e6af25c8e23a93026536ba469534 (diff)
downloadvdr-plugin-menuorg-f3bbcd9476beec7c43d2adb3bc0129ff8041d7ad.tar.gz
vdr-plugin-menuorg-f3bbcd9476beec7c43d2adb3bc0129ff8041d7ad.tar.bz2
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. git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/menuorg/trunk@5986 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r--HISTORY4
-rw-r--r--README2
-rw-r--r--src/menuconfiguration.cpp15
-rw-r--r--src/menuconfiguration.h3
-rw-r--r--src/version.h2
5 files changed, 22 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index c00a5df..7efe854 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/README b/README
index e562ca9..f9681b3 100644
--- a/README
+++ b/README
@@ -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