LINUX.ORG.RU

История изменений

Исправление Deleted, (текущая версия) :

Сейчас решаю так:

def convert_file(file_w,source_encoding,target_encoding):
        with open(file_w) as f:
                text=f.read()
        with open(file_w,'w') as f:
                f.write(unicode(text, source_encoding).encode(target_encoding))

convert_file(wda_html,'ISO-8859-5','UTF-8')
replace(wda_html,'charset=ISO-8859-1','charset=UTF-8')

Исходная версия Deleted, :

Сейчас решаю так:

def convert_file(file_w,source_encoding,target_encoding):
        with open(file_w) as f:
                text=f.read()
        with open(file_w) as f:
                f=open(file_w,"w")
                f.write(unicode(text, source_encoding).encode(target_encoding))

convert_file(wda_html,'ISO-8859-5','UTF-8')
replace(wda_html,'charset=ISO-8859-1','charset=UTF-8')