Repository: sciunto-org/python-bibtexparser

Issue:
Inconsistent results using `bibtexparser.latex_to_unicode`
Thanks for writing and maintaining this package!

I found that using `bibtexparser.latex_to_unicode` yields inconsistent results:

    >>> latex_to_unicode(r"p\^{a}t\'{e}")
    'pâté'
    >>> latex_to_unicode(r"\^{i}le")
    '{î}le'

Why are there braces around i-circumflex but not around a-circumflex or e-acut?

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/11631371/badge)](https://coveralls.io/builds/11631371)

Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/11631371/badge)](https://coveralls.io/builds/11631371)

Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/11631371/badge)](https://coveralls.io/builds/11631371)

Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.

sciunto: The failure seems to be related to this: https://github.com/travis-ci/travis-ci/issues/7771
sciunto: Could you rebase please?

Patch:
diff --git a/bibtexparser/latexenc.py b/bibtexparser/latexenc.py
index e225de4..b4ac36d 100644
--- a/bibtexparser/latexenc.py
+++ b/bibtexparser/latexenc.py
@@ -85,6 +85,9 @@ def latex_to_unicode(string):
     # to normalize to the latter.
     cleaned_string = unicodedata.normalize("NFC", "".join(cleaned_string))
 
+    # Remove any left braces
+    cleaned_string = cleaned_string.replace("{", "").replace("}", "")
+
     return cleaned_string
 
 


Test patch:
diff --git a/bibtexparser/tests/test_customization.py b/bibtexparser/tests/test_customization.py
index e38c078..d6d42b5 100644
--- a/bibtexparser/tests/test_customization.py
+++ b/bibtexparser/tests/test_customization.py
@@ -89,7 +89,16 @@ class TestBibtexParserMethod(unittest.TestCase):
         # From issue 121
         record = {'title': '{Two Gedenk\\"uberlieferung der Angelsachsen}'}
         result = convert_to_unicode(record)
-        expected = {'title': '{Two Gedenküberlieferung der Angelsachsen}'}
+        expected = {'title': 'Two Gedenküberlieferung der Angelsachsen'}
+        self.assertEqual(result, expected)
+        # From issue 161
+        record = {'title': r"p\^{a}t\'{e}"}
+        result = convert_to_unicode(record)
+        expected = {'title': "pâté"}
+        self.assertEqual(result, expected)
+        record = {'title': r"\^{i}le"}
+        result = convert_to_unicode(record)
+        expected = {'title': "île"}
         self.assertEqual(result, expected)
 
     ###########