Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reverse Unicode decomposition using Python?

Tags:

python

unicode

Using Python 2.5, I have some text in stored in a unicode object:

Dinis e Isabel, uma difı´cil relac¸a˜o conjugal e polı´tica

This appears to be decomposed Unicode. Is there a generic way in Python to reverse the decomposition, so I end up with:

Dinis e Isabel, uma difícil relação conjugal e política

like image 282
msanders Avatar asked Jan 15 '09 10:01

msanders


1 Answers

I think you are looking for this:

>>> import unicodedata    
>>> print unicodedata.normalize("NFC",u"c\u0327")
ç
like image 168
Rafał Dowgird Avatar answered Oct 13 '22 06:10

Rafał Dowgird