summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2019-11-14 14:13:48 +0000
committerPhilip Withnall <withnall@endlessm.com>2019-11-14 14:13:48 +0000
commitd649c1c443a5da13a16d3de6e628b36560acda50 (patch)
tree23f2015fb6bdfd691bd055a8141262359eed11dd
parent0dbfdfe12e320487735a05ef9b436ce144ee2633 (diff)
downloaddesktop-file-utils-d649c1c443a5da13a16d3de6e628b36560acda50.tar.gz
desktop-file-validate: Set locale so that output encoding is correct
The typical case is that UTF-8 values from a .desktop file are displayed on a UTF-8 terminal. If we don’t set the locale from the environment, though, libc assumes that the terminal only supports ASCII, and substitutes all non-ASCII characters with `?`. This makes (for example) Cyrillic characters in warning messages useless. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--src/validator.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/validator.c b/src/validator.c
index 7a3ed7d..104369d 100644
--- a/src/validator.c
+++ b/src/validator.c
@@ -26,6 +26,8 @@
* USA.
*/
+#include <locale.h>
+
#include "validate.h"
static gboolean warn_kde = FALSE;
@@ -49,6 +51,8 @@ main (int argc, char *argv[])
int i;
gboolean all_valid;
+ setlocale (LC_ALL, "");
+
context = g_option_context_new (NULL);
g_option_context_set_summary (context, "Validate desktop entry files "
"according to the Desktop Entry "