[ANNOUNCE] UTF-8 patch 0.0.3 with Freetype2, enAIO for vdr-1.3.24

Message ID 200505150028.55475.lars@altenhain.de
State New
Headers

Commit Message

Lars Altenhain May 14, 2005, 10:28 p.m. UTC
  Hi,

thanks for this patch. Finally the mp3 plugin can display the correct names of 
the mp3s.

My vdr runs since 2 days with this patch and I have found only a small 
error :-) If vdr is allows to update the channel names, the names revert back 
to the ISO8859 encoded version. The transmitted channel names are not 
converted to utf8 before they are stored in the config data. The attached 
patch fixes this. 

Best Regards
Lars Altenhain
  

Comments

Ludwig Nussel May 15, 2005, 11:52 a.m. UTC | #1
Lars Altenhain wrote:
> thanks for this patch. Finally the mp3 plugin can display the correct names of 
> the mp3s.
> 
> My vdr runs since 2 days with this patch and I have found only a small 
> error :-) If vdr is allows to update the channel names, the names revert back 
> to the ISO8859 encoded version. The transmitted channel names are not 
> converted to utf8 before they are stored in the config data. The attached 
> patch fixes this. 

It cannot work this way, you blindly recode iso-8859-1 to utf8.
Judging from how xawtv does it each dvb string tells it's encoding.
Therefore the central place to recode all strings must be
decodeText() in libsi/si.c. That also means that the encoding does
not need to be configured via channels.conf.

cu
Ludwig
  

Patch

diff -ruN --exclude='*~' vdr-1.3.24_utf_0.0.3/eit.c vdr-1.3.24_utf_0.0.3a/eit.c
--- vdr-1.3.24_utf_0.0.3/eit.c	2005-05-15 00:01:08.000000000 +0200
+++ vdr-1.3.24_utf_0.0.3a/eit.c	2005-05-15 00:21:49.000000000 +0200
@@ -165,15 +165,20 @@ 
                     if (hit) {
                        char linkName[ld->privateData.getLength() + 1];
                        strn0cpy(linkName, (const char *)ld->privateData.getData(), sizeof(linkName));
+		       char tmpiconvbuf[sizeof(linkName)*4];
+		       int newstrlen = CharSetConv(tmpiconvbuf,sizeof(linkName)*4, linkName, sizeof(linkName) ,"ISO8859-15", "UTF-8");
+		       char linkName_utf8[newstrlen];
+		       strn0cpy(linkName_utf8, tmpiconvbuf, newstrlen);
+		       
                        cChannel *link = Channels.GetByChannelID(linkID);
                        if (link != channel) { // only link to other channels, not the same one
                           //fprintf(stderr, "Linkage %s %4d %4d %5d %5d %5d %5d  %02X  '%s'\n", hit ? "*" : "", channel->Number(), link ? link->Number() : -1, SiEitEvent.getEventId(), ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId(), ld->getLinkageType(), linkName);//XXX
                           if (link) {
                              if (Setup.UpdateChannels >= 1)
-                                link->SetName(linkName, "", "");
+                                link->SetName(linkName_utf8, "", "");
                              }
                           else if (Setup.UpdateChannels >= 3) {
-                             link = Channels.NewChannel(channel, linkName, "", "", ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId());
+                             link = Channels.NewChannel(channel, linkName_utf8, "", "", ld->getOriginalNetworkId(), ld->getTransportStreamId(), ld->getServiceId());
                              //XXX patFilter->Trigger();
                              }
                           if (link) {
@@ -183,7 +188,7 @@ 
                              }
                           }
                        else
-                          channel->SetPortalName(linkName);
+                          channel->SetPortalName(linkName_utf8);
                        }
                     }
                  }
diff -ruN --exclude='*~' vdr-1.3.24_utf_0.0.3/sdt.c vdr-1.3.24_utf_0.0.3a/sdt.c
--- vdr-1.3.24_utf_0.0.3/sdt.c	2005-05-14 23:59:36.000000000 +0200
+++ vdr-1.3.24_utf_0.0.3a/sdt.c	2005-05-15 00:21:49.000000000 +0200
@@ -59,11 +59,17 @@ 
                         char NameBuf[1024];
                         char ShortNameBuf[1024];
                         char ProviderNameBuf[1024];
+                        char NameBuf_UTF8[1024*4];
+                        char ShortNameBuf_UTF8[1024*4];
+                        char ProviderNameBuf_UTF8[1024*4];
                         sd->serviceName.getText(NameBuf, ShortNameBuf, sizeof(NameBuf), sizeof(ShortNameBuf));
-                        char *pn = compactspace(NameBuf);
-                        char *ps = compactspace(ShortNameBuf);
+                        CharSetConv(NameBuf_UTF8,1024*4, NameBuf, strlen(NameBuf)+1 ,"ISO8859-15", "UTF8");
+                        CharSetConv(ShortNameBuf_UTF8,1024*4, ShortNameBuf, strlen(ShortNameBuf)+1 ,"ISO8859-15", "UTF8");
+                        char *pn = compactspace(NameBuf_UTF8);
+                        char *ps = compactspace(ShortNameBuf_UTF8);
                         sd->providerName.getText(ProviderNameBuf, sizeof(ProviderNameBuf));
-                        char *pp = compactspace(ProviderNameBuf);
+                        CharSetConv(ProviderNameBuf_UTF8,1024*4, ProviderNameBuf, strlen(ProviderNameBuf)+1 ,"ISO8859-15", "UTF8");
+                        char *pp = compactspace(ProviderNameBuf_UTF8);
                         if (channel) {
                            channel->SetId(sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId());
                            if (Setup.UpdateChannels >= 1)