New submission from Hugo Silva <hugo...@gmail.com>: Hi all,
I'm facing a huge encoding problem in Python when dealing with ISO-8859-1 / Latin-1 character set. When using os.listdir to get the contents of a folder I'm getting the strings encoded in ISO-8859-1 (ex: ''Ol\xe1 Mundo''), however in the Python interpreter the same string is encoded to a different charset: In : 'Olá Mundo'.decode('latin-1') Out: u'Ol\xa0 Mundo' How can I force Python to decode the string to the same format. I've seen that os.listdir is returning the strings correctly encoded but the interpreter is not ('á' character corresponds to '\xe1' in ISO-8859-1, not to '\xa0'): http://en.wikipedia.org/wiki/ISO/IEC_8859-1 This is happening Any thoughts on how to overcome ? Regards, ---------- components: Unicode messages: 147552 nosy: Hugo.Silva, ezio.melotti priority: normal severity: normal status: open title: Python ISO-8859-1 encoding problem versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13395> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com