Bug 364806 - Accents incorrectly saved in LaTeX encoding mode
Summary: Accents incorrectly saved in LaTeX encoding mode
Status: RESOLVED FIXED
Alias: None
Product: KBibTeX
Classification: Applications
Component: Loading/saving files (show other bugs)
Version: git (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-27 10:15 UTC by Fred Labrosse
Modified: 2016-06-28 07:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Labrosse 2016-06-27 10:15:49 UTC
Accents are not correctly saved, I think, when LaTeX encoding is used.  Fro example, the following is saved for an acute accent on 'e':

\'{e}

when it should be:

{\'e}

Reproducible: Always

Steps to Reproduce:
1. Use an accent in an author's name or any other field
2. Save the file using LaTeX encoding
3. Look at the resulting text file.

Actual Results:  
\'{e} is saved.

Expected Results:  
{\'e} should be saved.

The sequence "{e}" does nothing in LaTeX so "\'{e}" is the same as "\'e".  The brackets however need to surround the whole construct, as in "{\'e}" to protect it.
Comment 1 Thomas Fischer 2016-06-27 13:26:36 UTC
(In reply to Fred Labrosse from comment #0)
> Accents are not correctly saved, I think, when LaTeX encoding is used.  Fro
> example, the following is saved for an acute accent on 'e':
> \'{e}
> when it should be:
> {\'e}
Both are valid expressions that generate 'é'.

> The sequence "{e}" does nothing in LaTeX so "\'{e}" is the same as "\'e". 
In this specific case, yes.

> The brackets however need to surround the whole construct, as in "{\'e}" to
> protect it.
That is true.

As both forms are valid, it is essentially taste which of the two forms you prefer. Unless you can provide me with a counter example, where \'{X} breaks but {\'X} works.
Comment 2 Fred Labrosse 2016-06-27 16:25:14 UTC
It took me a while, but I finally found out what the problem was.  The problem is when the double dot (or whatever it's name is) accent is used, as in \"u.  This needs to be saved as {\"u} to make sure the quote is not parsed as a closing quote if this is the delimiter that is used.  Note that \"{u} does not work in that case.

So yes, your saving is correct for normal accents, but not for the double dot accent.  I just saved my bibfile and it produced:

@inproceedings{AF03,
        address = "Aberystwyth, UK",
        author = "Aloimonos, Yannis and Ferm\"{u}ller, Cornelia",
        booktitle = pbimvta,
        pages = "3--23",
        title = "Action Representations",
        year = 2003
}

and this does not work.  For consistency reasons, I tend to type them all the same (which is why I couldn't remember what the problem was).

See http://tex.stackexchange.com/questions/57743/how-to-write-ä-and-other-umlauts-and-accented-letters-in-bibliography for more details.
Comment 3 Thomas Fischer 2016-06-27 21:21:17 UTC
(In reply to Fred Labrosse from comment #2)
> It took me a while, but I finally found out what the problem was.  The
> problem is when the double dot (or whatever it's name is) accent is used, as
> in \"u.  This needs to be saved as {\"u} to make sure the quote is not
> parsed as a closing quote if this is the delimiter that is used.  Note that
> \"{u} does not work in that case.
Ok, thanks for the example. I think I fixed the problem in commit 8ba577fc0759de8e3c [1]. The fix got a little bit larger, as your link to Stack Exchange revealed some other issues, such as with {\c c}, which should be fixed as well.
There is a new file, testset/bib/bug364806.bib, which contains the examples from this Stack Exchange posting.
Please test and confirm.

[1] http://commits.kde.org/clones/kbibtex/thomasfischer/kbibtex/8ba577fc0759de8e3c998219031cfd394eb25022
Comment 4 Fred Labrosse 2016-06-28 07:50:20 UTC
Seems to work now.  Thanks.