diff --git a/contrib/binutils/binutils/strings.c b/contrib/binutils/binutils/strings.c
index d3247ea442d2..8bc618aa2e50 100644
--- a/contrib/binutils/binutils/strings.c
+++ b/contrib/binutils/binutils/strings.c
@@ -61,10 +61,27 @@
 #include "bucomm.h"
 #include "libiberty.h"
 
-#ifdef isascii
-#define isgraphic(c) (isascii (c) && (isprint (c) || isblank (c)))
+/* Some platforms need to put stdin into binary mode, to read
+    binary files.  */
+#ifdef HAVE_SETMODE
+#ifndef O_BINARY
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#define setmode _setmode
 #else
-#define isgraphic(c) (isprint (c) || isblank (c))
+#define O_BINARY 0
+#endif
+#endif
+#if O_BINARY
+#include <io.h>
+#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0)
+#endif
+#endif
+
+#ifdef isascii
+#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
+#else
+#define isgraphic(c) (isprint (c) || (c) == '\t')
 #endif
 
 #ifndef errno
@@ -220,6 +237,9 @@ main (argc, argv)
   if (optind >= argc)
     {
       datasection_only = false;
+#ifdef SET_BINARY
+      SET_BINARY (fileno (stdin));
+#endif
       print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
       files_given = true;
     }