diff --git a/googletrans/__init__.py b/googletrans/__init__.py index f1463bf..9f818df 100644 --- a/googletrans/__init__.py +++ b/googletrans/__init__.py @@ -1,6 +1,6 @@ """Free Google Translate API for Python. Translates totally free of charge.""" __all__ = 'Translator', -__version_info__ = 2, 1, 0 +__version_info__ = 2, 1, 1 __version__ = '.'.join(str(v) for v in __version_info__) diff --git a/googletrans/gtoken.py b/googletrans/gtoken.py index cfa4d50..34294a0 100644 --- a/googletrans/gtoken.py +++ b/googletrans/gtoken.py @@ -150,6 +150,7 @@ class TokenAcquirer(object): # append calculated value if l is less than 2048 elif l < 2048: e.append(l >> 6 | 192) + e.append(l) # append calculated value if l matches special condition elif (l & 64512) == 55296 and g + 1 < size and \ ord(text[g + 1]) & 64512 == 56320: diff --git a/tests/test_client.py b/tests/test_client.py index c264c62..2407ab0 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -27,6 +27,13 @@ def test_unicode(translator): assert result.text == u'こんにちは。' +def test_special_chars(translator): + text = u"Copyright © Google" + + result = translator.translate(text, src='en', dest='fr') + assert result.text == text + + def test_multiple_sentences(translator): text = u"""Architecturally, the school has a Catholic character. Atop the Main Building's gold dome is a golden statue of the Virgin Mary.