]> git.lyx.org Git - lyx.git/blobdiff - src/support/docstream.cpp
an example for the sweave module, prepared by Gregor Gorjanc
[lyx.git] / src / support / docstream.cpp
index bd2d010ff6e4e39f447df58391bc564a521babd0..ed2ddfe88b4bd6f8c1323f003c9c28c4e104dff3 100644 (file)
@@ -257,9 +257,10 @@ protected:
                    encoding_ == "GB" ||
                    encoding_ == "EUC-TW")
                        return 4;
-               else if (encoding_ == "EUC-JP" ||
-                        encoding_ == "ISO-2022-JP")
+               else if (encoding_ == "EUC-JP")
                        return 3;
+               else if (encoding_ == "ISO-2022-JP")
+                       return 8;
                else if (encoding_ == "BIG5" ||
                         encoding_ == "EUC-KR" ||
                         encoding_ == "EUC-CN" ||
@@ -280,6 +281,14 @@ private:
                                inbytesleft, to, outbytesleft);
                if (converted == (size_t)(-1)) {
                        switch(errno) {
+                       case 0: 
+                               // As strange as it may seem, this
+                               // does happen on windows when parsing
+                               // comments with accented chars in
+                               // tex2lyx. See the following thread
+                               // for details
+                               // http://thread.gmane.org/gmane.editors.lyx.devel/117636
+                               break;
                        case EINVAL:
                        case E2BIG:
                                return base::partial;
@@ -319,9 +328,9 @@ const char * iconv_codecvt_facet_exception::what() const throw()
 }
 
 
-ifdocstream::ifdocstream(string const & encoding) : base()
+ifdocstream::ifdocstream() : base()
 {
-       setEncoding(*this, encoding, in);
+       setEncoding(*this, "UTF-8", in);
 }