[PATCH] qv4l2: Fix UTF8 error message strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In locales such as el_GR.UTF-8, sterror() returns localised error
messages, which get printed as question marks due to the conversion
in QString::toLatin1().

Calling QString::toUtf8 instead, corrects this error.

Signed-off-by: Tasos Sahanidis <tasos@xxxxxxxxxxxx>
---
 utils/qv4l2/qv4l2.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 832f479e..b52a3b60 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -1705,7 +1705,7 @@ void ApplicationWindow::error(const QString &error)
 {
 	statusBar()->showMessage(error, 20000);
 	if (!error.isEmpty())
-		fprintf(stderr, "%s\n", error.toLatin1().data());
+		fprintf(stderr, "%s\n", error.toUtf8().data());
 }
 
 void ApplicationWindow::error(int err)
@@ -1780,7 +1780,7 @@ static bool processShortOption(const QStringList &args, int &i, QString &dev)
 		return false;
 	if (args[i].length() == 2) {
 		if (i + 1 >= args.size()) {
-			usageError(args[i].toLatin1());
+			usageError(args[i].toUtf8());
 			return false;
 		}
 		dev = args[++i];
@@ -1803,7 +1803,7 @@ static bool processLongOption(const QStringList &args, int &i, QString &dev)
 		return true;
 	}
 	if (i + 1 >= args.size()) {
-		usageError(args[i].toLatin1());
+		usageError(args[i].toUtf8());
 		return false;
 	}
 	dev = args[++i];
@@ -1857,7 +1857,7 @@ int main(int argc, char **argv)
 		} else if (args[i] == "-R" || args[i] == "--raw") {
 			raw = true;
 		} else {
-			printf("Invalid argument %s\n", args[i].toLatin1().data());
+			printf("Invalid argument %s\n", args[i].toUtf8().data());
 			return 0;
 		}
 	}
-- 
2.20.1



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux