Skip to content

Commit 631c651

Browse files
committed
bugfix
1 parent 0b1c697 commit 631c651

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

mwc.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def toAbsoluteURIs(trees, baseuri):
6464

6565

6666
def parseSite(site):
67+
global defaultEncoding
6768
file, content, titles, warning = None, None, None, None
6869

6970
uri = site['uri']
@@ -212,7 +213,7 @@ def genFeedItem(subject, content, link, change):
212213

213214
# sends mail notification
214215
def sendmail(receiver, subject, content, sendAsHtml, link):
215-
global mailsession
216+
global mailsession, defaultEncoding
216217

217218
if sendAsHtml:
218219
baseurl = None
@@ -243,30 +244,35 @@ def sendmail(receiver, subject, content, sendAsHtml, link):
243244

244245
# returns a list of all content that is stored locally for a specific site
245246
def getFileContents(shortname):
247+
global defaultEncoding
248+
246249
result = []
247250
for f in os.listdir('.'):
248251
if f.startswith(shortname + '.') and f.endswith('.txt'):
249252
file = open(f, 'rb')
250-
result.append(file.read().decode('utf-8', errors='ignore'))
253+
result.append(file.read().decode(defaultEncoding, errors='ignore'))
251254
file.close()
252255
return result
253256

254257

255258
# updates list of content that is stored locally for a specific site
256259
def storeFileContents(shortname, contents):
260+
global defaultEncoding
261+
257262
for f in os.listdir('.'):
258263
if f.startswith(shortname + '.') and f.endswith('.txt'):
259264
os.remove(f)
260265

261266
i = 0
262267
for c in contents:
263268
file = open(shortname + '.' + str(i) + '.txt', 'wb')
264-
file.write(c.encode('utf-8'))
269+
file.write(c.encode(defaultEncoding))
265270
file.close()
266271
i += 1
267272

268273

269274
def pollWebsites():
275+
global defaultEncoding
270276

271277
# parse existing feed or create a new one
272278
if config.enableRSSFeed:

0 commit comments

Comments
 (0)