lcd4l: try to fix encoding mess

Origin commit data
------------------
Branch: ni/coolstream
Commit: bdbd8b5592
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-09-26 (Mon, 26 Sep 2016)

Origin message was:
------------------
- lcd4l: try to fix encoding mess

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-09-26 18:35:56 +02:00
parent 60acefbf83
commit 3c5d25cc63
2 changed files with 13 additions and 17 deletions

View File

@@ -792,13 +792,13 @@ bool CLCD4l::WriteFile(const char *file, std::string content, bool convert)
if (convert) // align to internal lcd4linux font
{
strReplace(content, "ä", "<EFBFBD>");
strReplace(content, "ö", "<EFBFBD>");
strReplace(content, "ü", "<EFBFBD>");
strReplace(content, "Ä", "Ae");
strReplace(content, "Ö", "Oe");
strReplace(content, "Ü", "Ue");
strReplace(content, "ß", "<EFBFBD>");
strReplace(content, "ä", "\xe1\0");
strReplace(content, "ö", "\xef\0");
strReplace(content, "ü", "\xf5\0");
strReplace(content, "Ä", "\xc4\0");
strReplace(content, "Ö", "\xd6\0");
strReplace(content, "Ü", "\xdc\0");
strReplace(content, "ß", "\xe2\0");
strReplace(content, "é", "e");
}
@@ -853,17 +853,13 @@ bool CLCD4l::CompareParseID(uint64_t &i_ParseID)
return ret;
}
// stolen from gui/movieinfo.cpp
void CLCD4l::strReplace(std::string & orig, const char *fstr, const std::string rstr)
void CLCD4l::strReplace(std::string &orig, const std::string &fstr, const std::string &rstr)
{
unsigned int index = 0;
unsigned int fstrlen = strlen(fstr);
int rstrlen = rstr.size();
while ((index = orig.find(fstr, index)) != std::string::npos)
size_t pos = 0;
while ((pos = orig.find(fstr, pos)) != std::string::npos)
{
orig.replace(index, fstrlen, rstr);
index += rstrlen;
orig.replace(pos, fstr.length(), rstr);
pos += rstr.length();
}
}

View File

@@ -80,7 +80,7 @@ class CLCD4l
bool GetLogoName(uint64_t channel_id, std::string channel_name, std::string & logo);
std::string hexStr(unsigned char* data);
void strReplace(std::string & orig, const char *fstr, const std::string rstr);
void strReplace(std::string &orig, const std::string &fstr, const std::string &rstr);
bool WriteFile(const char *file, std::string content = "", bool convert = false);
// Variables