From patchwork Tue Dec 11 18:03:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1011261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Dp1k4rcQz9s9G for ; Wed, 12 Dec 2018 05:12:10 +1100 (AEDT) Received: from localhost ([::1]:40581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gWmVs-0005H1-4T for incoming@patchwork.ozlabs.org; Tue, 11 Dec 2018 13:12:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gWmOJ-0007RN-Gs for qemu-devel@nongnu.org; Tue, 11 Dec 2018 13:04:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gWmOI-0006xy-Jd for qemu-devel@nongnu.org; Tue, 11 Dec 2018 13:04:19 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:37243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gWmOD-0006uJ-Vy; Tue, 11 Dec 2018 13:04:14 -0500 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MCoYS-1gfXpV3o1o-008srl; Tue, 11 Dec 2018 19:04:06 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 11 Dec 2018 19:03:28 +0100 Message-Id: <20181211180352.19644-7-laurent@vivier.eu> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211180352.19644-1-laurent@vivier.eu> References: <20181211180352.19644-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:z5bX8gz6MFEW6bVIxa6soa6jRXAFS+jC6z8khHFDqOmkzpdQhNa LIe4s4qN1KiId+xyvisKBVmFZvCFC7DxtaT622po6Nx9rymDerGbgHXpJhgzEFo4zwt4Fls SLVvIC1y6iAI7Cb9ZNMUIGz7yTWfdpyhSJz2JVGMgvbDB/VPh6IVb8wcOmsbA0nvpwm25mg l8pW51o1rfy/j3knlwrNA== X-UI-Out-Filterresults: notjunk:1; V03:K0:BileiT3Smeg=:MYgWv0e8mV1K13a1Kg0DFK kuMv7+tOeQ3a8glDoWcqVYt4Ee72kyG4NXU3mcvSJziVp83n/V0JUTsOs8r2dRNAf3IXZgtp0 e80J1xmWuZ6U22iIigDa98iALFqOCaKZnQM8Q04VUPJpTKjowXE35zLIDD/V3C496H8H5Y+Oa xUaZGXJrGhRFdcmKg0ucUEP/1ERsvh+us/jhU+EkYn2qwJetbCTcvl/lrh7O46vK9hJyhC/HJ ZDDxSqiAm76Jj0D3N3hLIvfhIRJilB+QGzlHZVtvAMew1FMOY2PoKqVqWeBw//EfNl63ZPvdF a3R29HV8pJjr8hcu4SMM3qM1yPqT/t8ps7YDpItbmjCD1tSkZflPM6Mbwm3A8F7Dae6ef1bDc x1aH1D1ppSlM/FdhZQeoHaCDF6e71XjVqXEzdqR4kVztjIP5Cin73gIiqeSEr8SwU/wSs8g+w q3CzdjVeNI601m7ar//Uu4oS6A8gZZ+utu8AFGpjh3rtCnxt8H4DJdhWYQMG3tfwGHyjVX4B5 g1EZupxPzEHfaRGvOZgb7XgA4mDElifqwAVhwWnZ86l4oupXMF8ylfoYVoaiSxdB2xEg3zFWR pvd/92kDAT5CxLUl+EJPF9kZSyO+nXloIQ6OkjndmqVZZIqYDm7vtdX0J2zlfdbCTxdGwSkxj eT+80rChtNCPk194qxwdnArkXrdxixRZAPO0RSxI/VK6PqpTxM1knOXgeEhihL9L57DF/ZYvP rNG7LEDzHlx0zWXwQBp0ML1RXFFDaJLcHTlwmfNuZcf2ZVkDh55gge1hWFA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PULL 06/30] misc: Avoid UTF-8 in error messages X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , qemu-trivial@nongnu.org, Michael Tokarev , Laurent Vivier , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eric Blake 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 Signed-off-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Message-Id: <20181120203628.2367003-1-eblake@redhat.com> [lv: added command line to find non ASCII characters] Signed-off-by: Laurent Vivier --- hw/misc/tmp105.c | 2 +- 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 0918f3a6ea..f6d7163273 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 c234044305..eeb11000f0 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; }