“CSV UTF-8 к ISO-8859-1 Python” Ответ

CSV UTF-8 к ISO-8859-1 Python

$ iconv -f ISO-8859-1 -t UTF-8 source.txt > target.txt
Ugly Unicorn

CSV UTF-8 к ISO-8859-1 Python

import unicodecsv as csv

out = open(filename, 'w')
writer = csv.writer(out, dialect='excel', encoding='utf-8')
Ugly Unicorn

CSV UTF-8 к ISO-8859-1 Python

def fix_encoding(text):
    """ force utf-8 encoding """
    encodings = ('iso-8859-15','utf-8','ascii')
    success = False
    for encoding in encodings:
        try:
            utext = text.decode(encoding)
            success = True
            break
        except:
            success = False
    if success:
        return utext.encode('utf-8')
    return text
Ugly Unicorn

Ответы похожие на “CSV UTF-8 к ISO-8859-1 Python”

Вопросы похожие на “CSV UTF-8 к ISO-8859-1 Python”

Больше похожих ответов на “CSV UTF-8 к ISO-8859-1 Python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования