peterpa
Goto Top

Python mal utf-8 mal nicht

Hallo,

ich versuche gerade ein Programm zu schreiben, in Python, welches eine große HTML Datei in mehrere kleine aufspaltet. Das bekomme ich auch soweit hin nur, dass in der ersten Datei ÄÖÜ korrekt angezeigt werden und in den darauffolgenden offenbar kein UTF-8 mehr bekannt ist... anbei mal der Code:
def erstellen(kapitelList,count):
    anfang = 0
    name = "Anfang"  
    dateiIndex = 0
    outobj = open(inDataList)
    fobj = open("zz_"+name+".html",'w')  
    for x in range (0,count):
        fobj.write(outobj.readline())
        if dateiIndex < len(kapitelList) and x == kapitelList[dateiIndex].c -1 :
            name = name + "a"  
            fobj.close
            fobj = open("zzz_"+name+".html",'w')  
            dateiIndex = dateiIndex + 1
        else:
            fobj.close
    outobj.close

die Datei "zz_Anfang.html" kann ÄÖÜ
die Datei "zzz_Anfanga.html" nicht mehr.

Weiß jemand woran das liegt und wie ich das beheben kann? - Möglichst ohne Codecs... zumal es ja 1x wunderbar funktioniert...

P.S. ÄÖÜ soll natürlich angezeigt werden -> es sollen alle Dateien wie die erste sein.

Content-Key: 339292

Url: https://administrator.de/contentid/339292

Printed on: April 16, 2024 at 12:04 o'clock

Member: peterpa
peterpa May 30, 2017 at 12:29:18 (UTC)
Goto Top
Das war dann wohl spam... dachte es liegt an Python *hust*

Lösung:
<meta http-equiv=Content-Type content="text/html; charset=utf-8">