]> git.lyx.org Git - lyx.git/blobdiff - src/Lexer.cpp
Restore basic paragraph output for XHTML. The insets are all disabled still.
[lyx.git] / src / Lexer.cpp
index 546ae0e9e9e865cd7834ebe667421abc30db618b..e99875b28660286882eea04638e53b0848df2b3a 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gzstream.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/lyxalgo.h"
 #include "support/types.h"
@@ -251,7 +252,8 @@ bool Lexer::Pimpl::setFile(FileName const & filename)
                is.rdbuf(&gz_);
                name = filename.absFilename();
                lineno = 0;
-               return gz_.is_open() && is.good();
+               if (!gz_.is_open() || !is.good())
+                       return false;
        } else {
                LYXERR(Debug::LYXLEX, "lyxlex: UNcompressed");
 
@@ -266,8 +268,21 @@ bool Lexer::Pimpl::setFile(FileName const & filename)
                is.rdbuf(&fb_);
                name = filename.absFilename();
                lineno = 0;
-               return fb_.is_open() && is.good();
+               if (!fb_.is_open() || !is.good())
+                       return false;
        }
+
+       // Skip byte order mark.
+       if (is.peek() == 0xef) {
+               int c = is.get();
+               if (is.peek() == 0xbb) {
+                       c = is.get();
+                       LASSERT(is.get() == 0xbf, /**/);
+               } else
+                       is.unget();
+       }
+
+       return true;
 }