[vdr] Converting from UTF-8 to ISO-8859-1

Joachim Wilke joachim.wilke at gmail.com
Sun May 18 18:27:41 CEST 2008


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?

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


Best Regards,
Joachim.



More information about the vdr mailing list