[vlc-devel] [PATCH 4/4] intromsg: Ensure non-ascii characters are properly displayed on win32

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon Mar 12 16:07:03 CET 2018


refs #19874
---
 modules/control/dummy.c    | 14 ++++++++++++++
 modules/control/intromsg.h |  8 ++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/modules/control/dummy.c b/modules/control/dummy.c
index d2a40da110..623028df19 100644
--- a/modules/control/dummy.c
+++ b/modules/control/dummy.c
@@ -33,8 +33,22 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
+#include <vlc_charset.h>
 
 #ifdef _WIN32
+static void msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
+{
+    VLC_UNUSED(p_intf);
+    va_list args;
+    char fmt_eol[strlen (psz_fmt) + 3];
+
+    snprintf (fmt_eol, sizeof (fmt_eol), "%s\r\n", psz_fmt);
+    va_start( args, psz_fmt );
+    utf8_vfprintf( stdout, fmt_eol, args );
+    va_end( args );
+}
+#define msg_rc( ... ) msg_rc( p_intf, __VA_ARGS__ )
+
 #define QUIET_TEXT N_("Do not open a DOS command box interface")
 #define QUIET_LONGTEXT N_( \
     "By default the dummy interface plugin will start a DOS command box. " \
diff --git a/modules/control/intromsg.h b/modules/control/intromsg.h
index 7af95204b7..a0f85dce92 100644
--- a/modules/control/intromsg.h
+++ b/modules/control/intromsg.h
@@ -19,7 +19,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-static inline void intf_consoleIntroMsg(intf_thread_t *intf)
+static inline void intf_consoleIntroMsg(intf_thread_t *p_intf)
 {
     if (getenv( "PWD" ) == NULL) /* detect Cygwin shell or Wine */
     {
@@ -29,9 +29,9 @@ static inline void intf_consoleIntroMsg(intf_thread_t *intf)
         freopen("CONIN$", "r", stdin);
     }
 
-    msg_Info(intf, "VLC media player - %s", VERSION_MESSAGE);
-    msg_Info(intf, "%s", COPYRIGHT_MESSAGE);
-    msg_Info(intf, _("\nWarning: if you cannot access the GUI "
+    msg_rc("VLC media player - %s", VERSION_MESSAGE);
+    msg_rc("%s", COPYRIGHT_MESSAGE);
+    msg_rc(_("\nWarning: if you cannot access the GUI "
                      "anymore, open a command-line window, go to the "
                      "directory where you installed VLC and run "
                      "\"vlc -I qt\"\n"));
-- 
2.11.0



More information about the vlc-devel mailing list