Mercurial > hg > sidinfo
comparison sidinfo.c @ 341:fe061ead51cc
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.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 13 Jan 2020 16:29:47 +0200 |
parents | 6f8c431a3040 |
children | 020c4f21e861 |
comparison
equal
deleted
inserted
replaced
340:6f8c431a3040 | 341:fe061ead51cc |
---|---|
766 static void siPrintPSIDInfoLine(FILE *outfh, BOOL *shown, | 766 static void siPrintPSIDInfoLine(FILE *outfh, BOOL *shown, |
767 const char *fmt, const int otype, | 767 const char *fmt, const int otype, |
768 const char *d_str, const int d_int, | 768 const char *d_str, const int d_int, |
769 const BOOL convert) | 769 const BOOL convert) |
770 { | 770 { |
771 char *str, *tmp; | 771 char *formatted, *escaped; |
772 | 772 |
773 if (d_str != NULL && setChConv.enabled && convert) | 773 escaped = sidutil_escape_string(d_str, optEscapeChars); |
774 { | 774 |
775 char *tmp2 = sidutil_chconv_convert(&setChConv, d_str); | 775 if ((formatted = siItemFormatStrPrint(fmt, otype, escaped, d_int)) != NULL) |
776 tmp = sidutil_escape_string(tmp2, optEscapeChars); | 776 { |
777 th_free(tmp2); | 777 char *converted; |
778 } | 778 if (setChConv.enabled && convert && |
779 else | 779 (converted = sidutil_chconv_convert(&setChConv, formatted)) != NULL) |
780 tmp = sidutil_escape_string(d_str, optEscapeChars); | 780 { |
781 | 781 fputs(converted, outfh); |
782 if ((str = siItemFormatStrPrint(fmt, otype, tmp, d_int)) != NULL) | 782 th_free(converted); |
783 fputs(str, outfh); | 783 } |
784 | 784 else |
785 th_free(str); | 785 fputs(formatted, outfh); |
786 th_free(tmp); | 786 } |
787 | |
788 th_free(formatted); | |
789 th_free(escaped); | |
787 | 790 |
788 *shown = TRUE; | 791 *shown = TRUE; |
789 } | 792 } |
790 | 793 |
791 | 794 |