On Mon, Mar 06, 2017 at 05:53:58PM +0000, José Abílio Matos wrote:
> On Monday, 6 March 2017 12.35.47 WET Kornel Benko wrote:
> > Am Montag, 6. März 2017 um 13:13:58, schrieb Matěj Cepl <mc...@cepl.eu>
> > 
> > > Yes, this is not a minimal example, but I am hesitant to touch this
> > > document from LyX 2.1 so that I wouldn’t accidentally fixed it. When
> > > trying to open it with lyx-2.2.2-1.fc25.x86_64 I get this:
> > > 
> > > matej@mitmanek: marketa$ lyx Ph.D.project-Brno1.lyx
> > > Error: Document format failure
> > > ----------------------------------------
> > > /tmp/lyx_tmpdir.CLmZrzV11492/Buffer_convertLyXFormatk11492.lyx is not a
> > > readable LyX document.
> > > matej@mitmanek: marketa$
> > > 
> > > Any ideas, what's wrong?
> > > 
> > > Best,
> > > 
> > > Matěj
> > 
> > The document language is English. But there are 4 entries in the document
> > stating '\lang english'.
> > 
> > Removing this 4 lines, the document is readable.
> > 
> > OTOH, reading directly with lyx2.1, there is no problem.
> > 
> > For me it looks like lyx-deficiency.
> > 
> >     Kornel
> 
> I agree. A brief look into development/FORMAT does not give any clue about a 
> file format that could be responsible for this change.
> 
> The next step is then to pinpoint what is the problem, is this a problem of 
> lyx-2.1, of lyx2lyx or of the lyx-2.2 lexer?
> 
> If the problem is lyx-2.1 or lyx2lyx the change is simple we can add a last 
> change in the lyx-2.1 converter that removes this instances: \lang that match 
> the document language. The patch is easy enough but I would like to understand
> the disease before proposing a cure. ;-)

The problem is that the file starts with a U+FEFF BOM mark, and most
probably lyx2lyx doesn't expect to deal with BOM marks. Actually, the
conversion succeeds, but the BOM mark is left in place (it now appears
on the second line, though). Consequently, lyx then chokes on reading it.
It suffices removing the bogus second line of the converted file to make
it perfectly readable by lyx 2.2.
LyX 2.1 is able to read it because no conversion is necessary and the BOM
mark is skipped because it is dealt with by the lexer when it is at the
beginning of the file.

-- 
Enrico

Reply via email to