I want to change an srt file to unicode format so mpalyer can display
Chinese subtitles properly.
I did it like this:

txt=open('dmd-guardian-cd1.srt').read()
txt=unicode(txt,'gb18030')
open('dmd-guardian-cd1.srt','w').write(txt)

But it seems that python can't directly write unicode to a file,
I got and error at the 3rd line:
UnicodeEncodeError: 'ascii' codec can't encode characters in position
85-96: ordinal not in range(128)

How to save the unicode string to the file, please?
Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to