From 67910630042f252302a8561e468e9d0f7745e744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> Date: Fri, 25 Oct 2013 23:42:30 +0300 Subject: [PATCH] help: print UTF-8 BOM in vlc-help.txt on Windows --- src/config/help.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/config/help.c b/src/config/help.c index a36d2459541d..609b605eb561 100644 --- a/src/config/help.c +++ b/src/config/help.c @@ -695,8 +695,6 @@ static void Version( void ) *****************************************************************************/ static void ShowConsole( void ) { - FILE *f_help = NULL; - if( getenv( "PWD" ) ) return; /* Cygwin shell or Wine */ if( !AllocConsole() ) return; @@ -710,14 +708,13 @@ static void ShowConsole( void ) freopen( "CONOUT$", "w", stderr ); freopen( "CONIN$", "r", stdin ); - f_help = fopen( "vlc-help.txt", "wt" ); - if( f_help != NULL ) + if( freopen( "vlc-help.txt", "wt", stdout ) != NULL ) { - fclose( f_help ); - freopen( "vlc-help.txt", "wt", stdout ); - utf8_fprintf( stderr, _("\nDumped content to vlc-help.txt file.\n") ); + fputs( "\xEF\xBB\xBF", stdout ); + fprintf( stderr, _("\nDumped content to vlc-help.txt file.\n") ); } - else freopen( "CONOUT$", "w", stdout ); + else + freopen( "CONOUT$", "w", stdout ); } /***************************************************************************** -- GitLab