In TeX Live we use binary mode for all output files. diff -ur detex-2.8.orig/detex.l detex-2.8/detex.l --- detex-2.8.orig/detex.l 2012-08-24 10:37:03.000000000 +0200 +++ detex-2.8/detex.l 2012-08-24 10:51:12.000000000 +0200 @@ -83,6 +83,11 @@ #include #endif +#ifdef WIN32 +#include +#include +#endif + #endif /* KPATHSEA */ #undef IGNORE @@ -494,6 +499,10 @@ } SetEnvIgnore(sbEnvList); +#ifdef WIN32 + _setmode(fileno(stdout), _O_BINARY); +#endif + /* process input files */ for (; iArgs < cArgs; iArgs++) { fSawFile++;