Re: Converting from UTF-8 to ISO-8859-1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/18/08 18:27, Joachim Wilke wrote:
> Dear experts,
> 
> I am currently trying to convert a string to ISO-8859-1 using the
> following code fragment:
> 
>   cCharSetConv conv(NULL, "ISO-8859-1");
>   const char *s_converted = conv.Convert(string);
> 
> Running VDR with UTF-8, this conversion failes (i.e., s_converted == string).
> This is due to the fact, that cCharSetConv::SystemCharacterTable contains "NULL"
> instead of "UTF-8". This is because systemCharacterTable is never set:
> 
> void cCharSetConv::SetSystemCharacterTable(const char *CharacterTable)
> {
>   free(systemCharacterTable);
>   systemCharacterTable = NULL;
>   if (!strcasestr(CharacterTable, "UTF-8")) {
>      ..
>      systemCharacterTable = strdup(CharacterTable);
>      }
> }
> 
> Is there a reason for this?

systemCharacterTable is only set if it is a single byte character set,
which UTF-8 is not.

> The conversion works fine, if I use  "UTF-8" instead of "NULL":
>   cCharSetConv conv("UTF-8", "ISO-8859-1");

Good, so it works as designed ;-)

Klaus

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux