Back to index

moin  1.9.0~rc2
Functions
MoinMoin.filter.text Namespace Reference

Functions

def execute

Function Documentation

def MoinMoin.filter.text.execute (   indexobj,
  filename 
)

Definition at line 13 of file text.py.

00013 
00014 def execute(indexobj, filename):
00015     for enc in ('utf-8', 'iso-8859-15', ):
00016         try:
00017             f = codecs.open(filename, "r", enc)
00018             data = f.read()
00019             f.close()
00020             return data
00021         except UnicodeError:
00022             pass
00023     f = file(filename, "r")
00024     data = f.read()
00025     f.close()
00026     data = data.decode('ascii', 'replace')
00027     return data
00028