--- src/main.c	2005-07-01 03:20:30.000000000 +0400
+++ main.c	2006-10-16 17:37:09.111250000 +0400
@@ -31,6 +31,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <fcntl.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif /* HAVE_UNISTD_H */
@@ -45,7 +46,7 @@
 #endif
 #ifdef HAVE_NLS
 #ifdef HAVE_LOCALE_H
-# include <locale.h>
+
 #endif /* HAVE_LOCALE_H */
 #endif /* HAVE_NLS */
 #include <assert.h>
@@ -893,7 +894,10 @@
       extern int output_stream_regular;
 
       if (HYPHENP (opt.output_document))
-	output_stream = stdout;
+		{
+			output_stream = stdout;
+			_setmode(_fileno(output_stream), _O_BINARY);
+	}
       else
 	{
 	  struct_fstat st;
