Will unfold lines and then treat them as UTF-8.
Before folding lines, they're converted to 8-bit strings and split at 75 octets.
oldcal = '\r\n'.join(oldcal)
oldcal = oldcal.replace('\r\n ', '').replace('\r\n\t','')
- return oldcal.strip().split('\r\n')
+ return [unicode(x, 'utf-8') for x in oldcal.strip().split('\r\n')]
def lineFolder(oldcal, length=75):
sl = length - 1
for line in oldcal:
+ line = line.encode('utf-8')
# Line fits inside length, do nothing
if len(line.rstrip()) <= length:
cal.append(line)