From 2b701cc178cdaaf53a707106d8f733a4fe998ece Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 31 Jan 2004 11:58:06 +0000 Subject: [PATCH] Support UTF-8 output (Marcel Sebek, sebek64 at post dot cz). git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2254 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 0c1f2efb..04b083ec 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "lib/sensors.h" #include "lib/error.h" @@ -169,6 +171,8 @@ int main (int argc, char *argv[]) { 0,0,0,0 } }; + setlocale(LC_CTYPE, ""); + do_unknown = 0; do_sets = 0; show_algorithm = 0; @@ -248,7 +252,10 @@ int main (int argc, char *argv[]) close_config_file(); /* build the degrees string */ - sprintf(degstr, "%c", 176); + if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) + sprintf(degstr, "%c%c", 0xc2, 0xb0); + else + sprintf(degstr, "%c", 176); if (fahrenheit) { strcat(degstr, "F"); } else {