[vlc-commits] help: print UTF-8 BOM in vlc-help.txt on Windows

Rémi Denis-Courmont git at videolan.org
Fri Oct 25 22:43:55 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 25 23:42:30 2013 +0300| [67910630042f252302a8561e468e9d0f7745e744] | committer: Rémi Denis-Courmont

help: print UTF-8 BOM in vlc-help.txt on Windows

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67910630042f252302a8561e468e9d0f7745e744
---

 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 a36d245..609b605 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 );
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list