summaryrefslogtreecommitdiff
path: root/epgsearchtools.c
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger@gmx.de>2010-10-28 22:33:38 +0200
committerChristian Wieninger <cwieninger@gmx.de>2010-10-28 22:33:38 +0200
commitba87be9b2650796a507249c098eca815bff9b5e5 (patch)
treef17cea8ec57511e0b9026c72c9870c22c9a876e8 /epgsearchtools.c
parent9efac7dc163ee573072fe1cdf64fb0dceb655982 (diff)
downloadvdr-plugin-epgsearch-ba87be9b2650796a507249c098eca815bff9b5e5.tar.gz
vdr-plugin-epgsearch-ba87be9b2650796a507249c098eca815bff9b5e5.tar.bz2
fixed case insensitive searching with Utf-8 characters
Diffstat (limited to 'epgsearchtools.c')
-rw-r--r--epgsearchtools.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/epgsearchtools.c b/epgsearchtools.c
index c58ccc0..71a83a1 100644
--- a/epgsearchtools.c
+++ b/epgsearchtools.c
@@ -53,6 +53,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#endif
const char AllowedChars[] = trNOOP("$ abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&");
+extern bool isUTF8;
int CompareEventTime(const void *p1, const void *p2)
{
@@ -401,9 +402,24 @@ bool MatchesSearchMode(const char* szTest, const char* searchText, int mode, con
void ToLower(char* szText)
{
if (!szText)
- return;
- for (int loop = 0; szText[loop] !=0; loop++)
- szText[loop] = tolower(szText[loop]);
+ return;
+
+ if (!isUTF8)
+ {
+ for (int loop = 0; szText[loop] !=0; loop++)
+ szText[loop] = tolower(szText[loop]);
+ return;
+ }
+ else
+ {
+ int length = strlen(szText)+1;
+ uint* valueUtf8 = new uint[length];
+ int lengthUtf8 = Utf8ToArray(szText, valueUtf8, length);
+ for(int i=0; i<lengthUtf8; i++)
+ valueUtf8[i] = Utf8to(lower, valueUtf8[i]);
+ Utf8FromArray(valueUtf8, szText, length);
+ delete [] valueUtf8;
+ }
}
char* GetExtEPGValue(const cEvent* e, cSearchExtCat* SearchExtCat)