convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os import sys import glob EXT = '*.*' lst_uni = glob.glob(unicode(EXT)) os.system('chcp 437') lst_asci = glob.glob(EXT) print

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Iliya
Try smth like this: import unicodedata def remove_accents(str): nkfd_form = unicodedata.normalize('NFKD', unicode(str)) return u''.join([c for c in nkfd_form if not unicodedata.combining(c)]) -- http://mail.python.org/mailman/listinfo/python-list

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Peter Otten
coldpizza wrote: Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os import sys import glob EXT = '*.*' lst_uni = glob.glob(unicode(EXT)) os.system('chcp 437')

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Cool! Thanks to both Iliya and Peter! On May 6, 7:34 pm, Peter Otten __pete...@web.de wrote: coldpizza wrote: Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os