# HG changeset patch # User Matti Hamalainen # Date 1578925787 -7200 # Node ID fe061ead51cc9edb0aa2d2cc49b6c3caed6896a2 # Parent 6f8c431a30409cd445db1f9de72da8ba7790e56a Perform character set conversion after item formatting step instead of before it. This should remedy the potential issue of formatting not taking UTF8 multibyte into account, as our formatting unfortunately does not support multibyte encoding. This way the data should stay in ISO-8859-1 format just up to outputting it. diff -r 6f8c431a3040 -r fe061ead51cc sidinfo.c --- a/sidinfo.c Mon Jan 13 16:24:57 2020 +0200 +++ b/sidinfo.c Mon Jan 13 16:29:47 2020 +0200 @@ -768,22 +768,25 @@ const char *d_str, const int d_int, const BOOL convert) { - char *str, *tmp; + char *formatted, *escaped; - if (d_str != NULL && setChConv.enabled && convert) + escaped = sidutil_escape_string(d_str, optEscapeChars); + + if ((formatted = siItemFormatStrPrint(fmt, otype, escaped, d_int)) != NULL) { - char *tmp2 = sidutil_chconv_convert(&setChConv, d_str); - tmp = sidutil_escape_string(tmp2, optEscapeChars); - th_free(tmp2); + char *converted; + if (setChConv.enabled && convert && + (converted = sidutil_chconv_convert(&setChConv, formatted)) != NULL) + { + fputs(converted, outfh); + th_free(converted); + } + else + fputs(formatted, outfh); } - else - tmp = sidutil_escape_string(d_str, optEscapeChars); - if ((str = siItemFormatStrPrint(fmt, otype, tmp, d_int)) != NULL) - fputs(str, outfh); - - th_free(str); - th_free(tmp); + th_free(formatted); + th_free(escaped); *shown = TRUE; }