From: Ben Pfaff Date: Mon, 25 Apr 2011 04:41:02 +0000 (-0700) Subject: MRSETS: Recode counted value to UTF-8 before displaying. X-Git-Tag: v0.7.8~35 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=6da3e7abfa0b4129156bb7e9f6797a07d4fbbb3e MRSETS: Recode counted value to UTF-8 before displaying. Otherwise they display incorrectly if a counted value contains non-ASCII characters. --- diff --git a/src/language/dictionary/mrsets.c b/src/language/dictionary/mrsets.c index f607ac92..621cdc88 100644 --- a/src/language/dictionary/mrsets.c +++ b/src/language/dictionary/mrsets.c @@ -579,8 +579,14 @@ parse_display (struct lexer *lexer, struct dictionary *dict) if (mrset->width == 0) ds_put_format (&details, "%.0f\n", mrset->counted.f); else - ds_put_format (&details, "`%.*s'\n", mrset->width, - value_str (&mrset->counted, mrset->width)); + { + const uint8_t *raw = value_str (&mrset->counted, mrset->width); + char *utf8 = recode_string ("UTF-8", dict_get_encoding (dict), + CHAR_CAST (const char *, raw), + mrset->width); + ds_put_format (&details, "`%s'\n", utf8); + free (utf8); + } ds_put_format (&details, "%s: %s\n", _("Category label source"), (mrset->cat_source == MRSET_VARLABELS ? _("Variable labels")