diff options
author | Eric Blake <eblake@redhat.com> | 2018-11-20 14:36:28 -0600 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-12-11 18:28:46 +0100 |
commit | 3381466dc95f5ee7087caa8fee77920bc03b0e62 (patch) | |
tree | 7d6e75fb956fa7e78b697f30c848629e48aee95f | |
parent | bf582c3461b23b1b9f1565d0ffbdc9e1ce076f8e (diff) | |
download | qemu-3381466dc95f5ee7087caa8fee77920bc03b0e62.zip qemu-3381466dc95f5ee7087caa8fee77920bc03b0e62.tar.gz qemu-3381466dc95f5ee7087caa8fee77920bc03b0e62.tar.bz2 |
misc: Avoid UTF-8 in error messages
While most developers are now using UTF-8 environments, it's
harder to guarantee that error messages will be output to
a multibyte locale. Rather than risking error messages that
get corrupted into mojibake when the user runs qemu in a
non-multibyte locale, let's stick to straight ASCII error
messages, rather than assuming that our use of UTF-8 in source
code string constants will work unchanged in other locales.
Found with:
$ LC_ALL=C git grep -l $'".*[\x80-\xff].*"' origin -- '**/*.[ch]' | cat
origin:hw/misc/tmp105.c
origin:hw/misc/tmp421.c
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181120203628.2367003-1-eblake@redhat.com>
[lv: added command line to find non ASCII characters]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r-- | hw/misc/tmp105.c | 2 | ||||
-rw-r--r-- | hw/misc/tmp421.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index 0918f3a..f6d7163 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -79,7 +79,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, return; } if (temp >= 128000 || temp < -128000) { - error_setg(errp, "value %" PRId64 ".%03" PRIu64 " °C is out of range", + error_setg(errp, "value %" PRId64 ".%03" PRIu64 " C is out of range", temp / 1000, temp % 1000); return; } diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index c234044..eeb1100 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -153,7 +153,7 @@ static void tmp421_set_temperature(Object *obj, Visitor *v, const char *name, } if (temp >= maxs[ext_range] || temp < mins[ext_range]) { - error_setg(errp, "value %" PRId64 ".%03" PRIu64 " °C is out of range", + error_setg(errp, "value %" PRId64 ".%03" PRIu64 " C is out of range", temp / 1000, temp % 1000); return; } |