- for line in incfd:
- if line.endswith("\n") and not line.endswith("\r\n"):
- line = line.replace("\n", "\r\n")
- replacement += line
- # lose the trailing eol
- replacement = replacement[:-2]
+ with codecs.open(incfile, "r", "utf-8") as incfd:
+ for line in incfd:
+ if line.endswith("\n") and not line.endswith("\r\n"):
+ line = line.replace("\n", "\r\n")
+ replacement += line
+ # lose the trailing eol
+ replacement = replacement[:-2]