diff options
author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-07-19 21:19:44 +0000 |
---|---|---|
committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-07-19 21:19:44 +0000 |
commit | b40d2c550444c61c25a1c2ec2dbd472dd11d2b62 (patch) | |
tree | 9e6f69e97ab8a44f037add988f3c80b1c408fec8 | |
parent | 0ff607eb3b557f24f1e173be00323d89068df662 (diff) | |
download | vdr-plugin-live-b40d2c550444c61c25a1c2ec2dbd472dd11d2b62.tar.gz vdr-plugin-live-b40d2c550444c61c25a1c2ec2dbd472dd11d2b62.tar.bz2 |
- added support for sending vdr's internally used character encoding in responses
-rw-r--r-- | i18n.cpp | 8 | ||||
-rw-r--r-- | i18n.h | 22 | ||||
-rw-r--r-- | pages/xmlresponse.ecpp | 3 | ||||
-rw-r--r-- | tntconfig.cpp | 2 |
4 files changed, 33 insertions, 2 deletions
@@ -4,7 +4,7 @@ extended version of i18n.cpp. (If you would like to submit a patch add more context like described below) - $Id: i18n.cpp,v 1.96 2007/07/18 23:48:14 tadi Exp $ + $Id: i18n.cpp,v 1.97 2007/07/19 21:19:44 lordjaxom Exp $ Note to developers: How to safely integrate translations from third parties: @@ -30,6 +30,12 @@ namespace vdrlive { +I18n& LiveI18n() +{ + static I18n instance; + return instance; +} + const tI18nPhrase Phrases[] = { { "Live Interactive VDR Environment", "Live Interactive VDR Environment", @@ -1,10 +1,32 @@ #ifndef VDR_LIVE_I18N_H #define VDR_LIVE_I18N_H +#include <vdr/config.h> #include <vdr/i18n.h> namespace vdrlive { +class I18n +{ + friend I18n& LiveI18n(); + + char const* m_encoding; + + I18n( I18n const& ); // don't copy + I18n() : m_encoding( +#if VDRVERSNUM >= 10503 + cCharSetConv::SystemCharacterTable() ? cCharSetConv::SystemCharacterTable() : "UTF-8" +#else + I18nCharSets()[::Setup.OSDLanguage] +#endif + ) {} + +public: + char const* CharacterEncoding() const { return m_encoding; } +}; + +I18n& LiveI18n(); + extern const tI18nPhrase Phrases[]; } // namespace vdrlive diff --git a/pages/xmlresponse.ecpp b/pages/xmlresponse.ecpp index 1123368..54fe088 100644 --- a/pages/xmlresponse.ecpp +++ b/pages/xmlresponse.ecpp @@ -1,5 +1,6 @@ <%pre> #include <string> +#include "i18n.h" using namespace std; </%pre> @@ -14,7 +15,7 @@ using namespace std; bool result; string error; </%args> -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="<$ LiveI18n().CharacterEncoding() $>"?> <service> <request name="<$ name $>"> <param name="<$ pname $>"><$ value $></param> diff --git a/tntconfig.cpp b/tntconfig.cpp index 7f412ba..1094b8a 100644 --- a/tntconfig.cpp +++ b/tntconfig.cpp @@ -5,6 +5,7 @@ #include <stdexcept> #include <vdr/config.h> #include <vdr/plugin.h> +#include "i18n.h" #include "live.h" #include "setup.h" #include "tntconfig.h" @@ -57,6 +58,7 @@ void TntConfig::WriteConfig() file << "MapUrl /([^.]+)(\\..+)? $1@" << endl; file << "PropertyFile " << m_propertiesPath << endl; file << "SessionTimeout 86400" << endl; + file << "DefaultContentType \"text/html; charset=" << LiveI18n().CharacterEncoding() << "\"" << endl; Setup::IpList const& ips = LiveSetup().GetServerIps(); int port = LiveSetup().GetServerPort(); |