From: Peter Kümmel Date: Tue, 15 May 2007 18:45:23 +0000 (+0000) Subject: bug 3203: try to load as local 8-bit encoded when it is not utf-8 X-Git-Tag: 1.6.10~9748 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=daf8c932ce32e0164bfb3976e136308098150ab8;p=features.git bug 3203: try to load as local 8-bit encoded when it is not utf-8 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18356 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/callback.cpp b/src/callback.cpp index cdb6686f98..05a89db245 100644 --- a/src/callback.cpp +++ b/src/callback.cpp @@ -399,7 +399,18 @@ docstring const getContentsOfPlaintextFile(BufferView * bv, string const & f, #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" + "If this does not give the correct result\n" + "then please change the encoding of the file\n" + "to UTF-8 with a program other than LyX.\n")); + file_content = from_local8bit(tmpstr); + } + + return normalize_kc(file_content); }