From d649c1c443a5da13a16d3de6e628b36560acda50 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 14 Nov 2019 14:13:48 +0000 Subject: desktop-file-validate: Set locale so that output encoding is correct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/validator.c | 4 ++++ 1 file changed, 4 insertions(+) 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 + #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 " -- cgit v1.2.3