]> git.lyx.org Git - features.git/commitdiff
Following rev 21967: final touch to odocfstream:
authorAbdelrazak Younes <younes@lyx.org>
Sat, 29 Dec 2007 18:04:43 +0000 (18:04 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 29 Dec 2007 18:04:43 +0000 (18:04 +0000)
- odocfstream: properly fix plaintext output by getting rid of ctor with std::string argument as this can be mixed up with std::ofstream(std::string) ctor where the argument is a file. UTF8 is now the default encoding.
- PreviewLoader::Impl::startLoading(): catch another potential iconv exception.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22332 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/graphics/PreviewLoader.cpp
src/output_plaintext.cpp
src/support/docstream.cpp
src/support/docstream.h

index 1926ed988b5927e9b6376aeb16282dbdbabad9e8..3777370501b536bf663bb992b0f134e603b4afde 100644 (file)
@@ -1209,7 +1209,6 @@ void Buffer::makeDocBookFile(FileName const & fname,
 {
        LYXERR(Debug::LATEX, "makeDocBookFile...");
 
-       //ofstream ofs;
        odocfstream ofs;
        if (!openFileWrite(ofs, fname))
                return;
index 2f6206f1272fe52e978ade3e5ef0811bfa7167e9..a46bfd169d3d076aac225da922c2017e29b2dfe3 100644 (file)
@@ -554,7 +554,14 @@ void PreviewLoader::Impl::startLoading()
 
        // we use the encoding of the buffer
        Encoding const & enc = buffer_.params().encoding();
-       odocfstream of(enc.iconvName());
+       odocfstream of;
+       try { of.reset(enc.iconvName()); }
+       catch (iconv_codecvt_facet_exception & e) {
+               LYXERR0("Caught iconv exception: " << e.what()
+                       << "\nUnable to create LaTeX file: " << latexfile);
+               return;
+       }
+
        TexRow texrow;
        OutputParams runparams(&enc);
        LaTeXFeatures features(buffer_, buffer_.params(), runparams);
index b1c4ec88adc6b262b9e876af5677cf92e38fa8af..452b4c10d834f4fc792cec6bfaa87bb53df0de27 100644 (file)
@@ -35,7 +35,6 @@ void writePlaintextFile(Buffer const & buf, FileName const & fname,
        OutputParams const & runparams)
 {
        odocfstream ofs;
-       ofs << setEncoding("UTF-8");
        if (!openFileWrite(ofs, fname))
                return;
        writePlaintextFile(buf, ofs, runparams);
index 4f390dedc0d8d40bab517c0fa6a6f579b0b3122e..82ec8dc54d270e25a9b85381db0599a647426abb 100644 (file)
@@ -298,12 +298,7 @@ idocfstream::idocfstream(const char* s, ios_base::openmode mode,
 
 odocfstream::odocfstream(): base()
 {
-}
-
-
-odocfstream::odocfstream(string const & encoding) : base()
-{
-       setEncoding(*this, encoding, out);
+       setEncoding(*this, "UTF-8", out);
 }
 
 
index 50fb82b7bc3974087acf19084db542036f8e6f56..c3a82260144ea665fff864853037e582c08e20c3 100644 (file)
@@ -58,7 +58,6 @@ class odocfstream : public std::basic_ofstream<char_type> {
        typedef std::basic_ofstream<char_type> base;
 public:
        odocfstream();
-       odocfstream(std::string const & encoding);
        explicit odocfstream(const char* s,
                std::ios_base::openmode mode = std::ios_base::out|std::ios_base::trunc,
                std::string const & encoding = "UTF-8");