http://bugzilla.lyx.org/show_bug.cgi?id=3203


Attached a patch which is better than the current code.


Peter

Index: src/callback.cpp
===================================================================
--- src/callback.cpp    (revision 18346)
+++ src/callback.cpp    (working copy)
@@ -399,7 +399,18 @@
 #endif
 
        // FIXME UNICODE: We don't know the encoding of the file
-       return normalize_kc(from_utf8(tmpstr));
+       docstring file_content = from_utf8(tmpstr);
+       if (file_content.empty()) {
+               Alert::error(_("Reading not UTF-8 encoded file"), 
+                                       _("The file is not UTF-8 encoded.\n"
+                                       "It will be read as local 
8Bit-encoded.\n"
+                                       "When this does not give the correct 
result\n"
+                                       "then please change the encoding of the 
file\n"
+                                       "to UTF-8 with a other program than 
LyX."));
+               file_content = from_local8bit(tmpstr);
+       }
+       
+       return normalize_kc(file_content);
 }
 
 

Reply via email to