[vlmc-devel] Make UTF-8 a default codec for strings in the non-gui main.

Yikai Lu git at videolan.org
Fri Mar 4 17:14:14 CET 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Thu Mar  3 14:22:50 2016 +0900| [7a934b49eb97f94a5dd6036c2dc959e06f11e6f4] | committer: Hugo Beauzée-Luyssen

Make UTF-8 a default codec for strings in the non-gui main.

Refer to https://mailman.videolan.org/pipermail/vlmc-devel/2016-March/001672.html,

"Qt4 doesn't handle strings as UTF-8 in the default settings. According to VideoLan's documentation[1], it says "As a general rules, all character strings passed to LibVLC should be in UTF-8."
Therefore, by setting QTextCodec::setCodecForCStrings, Qt4 will use UTF-8 and the import error will be fixed."

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/7a934b49eb97f94a5dd6036c2dc959e06f11e6f4
---

 src/Main/main.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index 7d8d4df..ed4a7db 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -180,6 +180,9 @@ VLMCGuimain( int argc, char **argv )
 int
 VLMCCoremain( int argc, char **argv )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
+    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
+#endif
     QCoreApplication app( argc, argv );
 
     Backend::IBackend* backend;



More information about the Vlmc-devel mailing list